I’m writing this down because it too me an age to figure out a way of doing this. I have a website which Tomcat is happily serving. Areas of the site require a secure connection so I’m using Spring security to require particular URLs to be accessed over HTTPS. It means that when I access http://example.org:8080/webapp/login, it’ll bump me to https://example.org:8443/webapp/login. Note: Tomcat is setup with the SSL connector and a self signed .keystore see (http://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html).
I have two vhosts setup in Apache, one for the http://example.org and one for https://example.org. They are both using mod_proxy to ProxyPass and ProxyPassReverse requests to the appropriate Tomcat URL’s. The problem comes when switching to HTTPS from HTTP and vice versa. Ideally I wanted some sort of ProxyPassReverse declaration in my config for http://example.org what would change HTTP headers (that Spring sets) for https://example.org:8443/webapp into https://example.org. Except ProxyPassReverse doesn’t work like that.
Now, I realise I could simply not use Spring to manage which parts of the site should be accessed over HTTPS and which should not…and just setup Apache to redirect as appropriate. I don’t want to do that though, because that makes the task of adding these restrictions a deploy time task, rather than a development time task. I don’t want to risk someone forgetting to add new restrictions when deploying the webapp and I’d much rather the developer added these restrictions when they were working on the task and really thinking about where and when they are needed.
So, how do I solve the problem so that the app can manage its secure-ness and I can setup Apache once and forget about it? The answer is to ProxyPassReverse onto a “special” URL, which when accessed will redirect to the HTTPS (or HTTP) site. For example, if the HTTP site needed to redirect to the HTTPS site, I’d add rules like so to perform the redirect:
# Proxy a request (from the server) to switch to https onto a special URL "/2https/"
ProxyPassReverse /2https/ https://example.org:8443/webapp/
# When a client requests a URL prefixed with "/2https" map it onto the secure site
RewriteRule ^/2https/(.*)$ https://example.org/$1 [R,L]
…and you’d add something similar to the secure site Apache config. As long as I don’t mount any pages at /2http or /2https I should be ok. Note a couple of things:
- You’ll need “SSLProxyEngine on” and “RewriteEngine on” and obviously the appropriate Apache modules loaded for these commands.
- Because of the redirect between HTTP <-> HTTPS you won’t be able to POST data between them directly (I’m not sure why you’d NEED to though)
- Obviously you’ll need to setup Apache with an SSL certificate…but that is a different story
I should say a special thanks to this random site – from whence the idea actually came from. If anyone has any better ideas on how to do it I’d love to hear them. Please comment below.
порно с дедом
BlueStream Lane – Great selection, layout feels modern and overall experience enjoyable.
плоская крыша под ключ https://ustrojstvo-ploskoj-krovli.ru
morning quartz treasures – Simple layout, readable content, and navigation feels stress-free.
everyday emporium – The design feels intentional, making the site comfortable to use.
rift and root shop online – Great browsing, descriptions are helpful and items look original.
IronWave Collection – Easy-to-use interface and items seem carefully chosen.
everymomentmatters.click – Uplifting site, browsing feels calm and inspires thoughtful reflection.
Opal Wild Shop – Clean design, items seem carefully chosen and browsing is simple.
amber hollow click shop – Very user-friendly, site loads fast and navigation is clear.
brassfield picks – Fun to explore, product images look real and shopping is intuitive.
Login – Simple pages, quick navigation, and instructions are easy to follow.
moss & maple boutique – Items feel selected with care and product info is straightforward.
northwildtrading.shop – The range caught my attention, ended up browsing longer than planned.
Riftstone Finds – Nice selection of items, store feels organized and browsing is simple.
inspired ideas click – Fast-loading pages, engaging content, and easy navigation throughout.
Petal & Ember Treasures – Smooth experience, products are well-photographed and easy to explore.
amber trail curated – Items seem high-quality, with helpful descriptions for every product.
Brass Lane Gems – Unique and charming finds, navigation is simple and descriptions are clear.
Salt Meadow Shop – Had a great time exploring the site, the selection feels fresh and well put together.
mosslight treasures – Attractive interface with practical usability, shopping is smooth.
rustic trading site – Browsing turned into a longer session thanks to the selection.
Suncrest Finds – A great browsing experience with items that feel selected with care.
стайлер дайсон для волос с насадками цена купить официальный сай… fen-dn-kupit-11.ru .
Wild Harbor Marketplace – Items are distinct and browsing the site was smooth and enjoyable.
Sunwoven Official – Quick browsing with products that caught my attention right away.
River Bloom Shop – Lovely layout, products look carefully chosen and navigation is simple.
fresh finds market – Quick navigation, interesting products, and enjoyable overall.
petal quarry finds – Great assortment of items, pages load quickly and checkout is simple.
Willow Shop – Browsing is smooth, items appear well organized and appealing.
brass quartz boutique – Easy to explore, items are nicely displayed and purchase process feels smooth.
ashen fern curated shop – Pleasant and smooth experience, site is easy to explore.
Salt Wind Finds – Looking around feels relaxing and visually pleasing.
Wild Harbor Studio – Really enjoyed exploring; products appear original and carefully chosen.
northbay online marketplace – Simple to browse, well-organized and feels trustworthy.
handpicked finds store – Every item seems thoughtfully chosen, giving a welcoming atmosphere.
Suncrest Lane Studio – A pleasant, uncluttered design makes browsing enjoyable.
Thistle & Stone Collection Hub – Rustic charm and easy-to-use layout make browsing items smooth and enjoyable.
River Quartz Finds Online – Smooth layout, items are well chosen and shopping feels convenient.
Pine Echo Finds – Nice layout, browsing the products felt simple and straightforward.
shop the day hub – Fast navigation, checkout is simple, and overall process is smooth.
Wind River Collection – Easy to browse, products appear curated and accessible.
Shop Bright Ridge Outlet – Navigation is simple, items look good and buying feels effortless.
Wild Hollow Collection Hub – Pleasant, uncluttered design with soothing colors enhances the shopping experience.
ashen willow curated – Smooth and organized, navigation feels effortless throughout.
Explore Sea Breeze – The calm color palette and layout keep things easy to navigate.
northernpetalstore.shop – Unique products, easy-to-navigate layout, and clear details.
unique boutique finds – A delightful shop vibe with carefully curated pieces.
Sunfield Selection – Smooth navigation and concise product info made shopping easy.
Thunder Willow Online – Lovely visuals and helpful descriptions make browsing simple and enjoyable.