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.
стоимость услуг domeo domeo-otzivy.com .
RareWrapp Collection – Clean interface, finding and selecting items is easy and fast.
SnugNook Market – Relaxed and tidy, items are displayed clearly and checkout is simple.
mobiln? casino casino-cz-3.com .
Suave Shelf Treasures – Neat and organized, product images are clear and shopping felt enjoyable.
mobiln? casino casino-cz-6.com .
boostengine.click – Bookmarked this immediately, planning to revisit for updates and inspiration.
Veromint Essentials – Well-designed with nice colors, navigation felt very straightforward.
Gadget Finds Today – Nice balance of style and everyday usefulness.
Truvora Network – Seamless browsing, giving a reliable and well-structured feel.
мостбет восстановить пароль мостбет восстановить пароль
WatchWhisper Online – Easy to navigate, products are displayed neatly and look appealing.
cz casina cz casina .
nov? ?esk? online casino nov? ?esk? online casino .
BrewBrooks online picks – High-quality brewing gear, makes shopping quick and enjoyable.
pin up móvil pin up móvil
Prism Porter Goods – Clean and organized layout, shopping felt fast and smooth.
Pendant Port Hub – Clean presentation, accessories stand out and browsing is easy.
SerumStation Market – Clean look, finding products is simple and shopping was enjoyable.
fiorvyn.shop – Lovely collection of premium items, makes shopping enjoyable every time.
Pantry Central – Warm environment, locating items felt natural and smooth.
Novalyn Goods – Minimal layout and uncluttered presentation let the items shine attractively.
Orbit Olive Essentials – Easy navigation, vibrant display, and products are quick to compare.
Mint Marketry Storefront – Smooth performance across the site with an easy checkout.
Veromint Store – Appealing visuals, smooth browsing made the experience enjoyable.
1win crash https://1win5756.help/
Soap Sonder Boutique – Neat and curated, browsing categories is easy and checkout went smoothly.
Sunny Shipment Studio – Simple design, checkout worked easily and shipping was reliable.
Raventia Finds – Sleek design, browsing items was simple and checkout felt smooth.
mostbet app https://mostbet12037.ru
Tulip Trade Picks – Simple, clean layout and the purchase process is smooth and dependable.
casino bonus bez vkladu casino-cz-1.com .
pin-up app apuestas deportivas http://www.pinup2001.help
WearWhimsy Essentials – Playful designs, navigation is simple and shopping feels smooth.
Tervina Online Shop – Easy to look around, stylish items stand out, and costs feel balanced.
1win cum primesc cashback https://1win5756.help
Prism Vane Online – Attractive products, images are clear and site layout is easy to use.
Shop Serenity Store – Gentle aesthetic, navigating categories feels easy and checkout was seamless.
Peony Port Picks Hub – Elegant layout, understanding products is effortless.
Vetrivine Corner – Well-curated and organized, variety keeps browsing interesting.
Pantry Spot – Lovely concept, browsing items was simple and quick.
mostbet депозит mostbet депозит
cash out 1win 1win5756.help
Soothesail Selects – Calm and neat, navigation is easy and checkout went smoothly.
Sunny Shopline Finds – Bright design, navigation is intuitive and checkout went smoothly.
pin up móvil https://www.pinup2001.help
Orbit Opal Collection – Stylish interface, images are vibrant and details are clear.
Raynora Boutique – Stylish layout, browsing categories is fast and checkout process seamless.
Mint Maven Finds – The selection feels fresh and fashionable without pushing the budget.
vavada blokada konta po logowaniu https://vavada2005.help/