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.
аудит продвижения сайта аудит продвижения сайта .
1win latest apk download https://www.1win5524.ru
Novibet tá bombando com roleta diária: 50–200 giros grátis no Fortune Tiger toda noite
частный seo оптимизатор частный seo оптимизатор .
Fortune Ox respins infinitos: já chegou a 30 respins seguidos? Conta o lucro!
mostbet 3d secure https://www.mostbet2017.help
как обновить melbet https://melbet06374.help/
Werde vom ersten Tag an Betano VIP. Schalte bis zu €500 Willkommensbonus frei https://betanogame.org/de/ und genieße exklusive Live-Casino-Spiele. Gewinne groß und zahle schnell aus.
комплексное продвижение сайтов москва комплексное продвижение сайтов москва .
mostbet mines demo mostbet02894.help
продвижение наркологии seo-kejsy17.ru .
seo кейсы seo кейсы .
The sips command-line tool performs batch image processing operations like resizing rotating and format conversion without opening graphical applications. Check this out: shell script to automate macos hidden sharing service defaults Go to details: The HealthKit repository securely stores and shares fitness metrics medical records and vital signs between authorized apps.
лучшие агентства seo продвижения reiting-seo-kompanii.ru .
мостбет депозит не пришел мостбет депозит не пришел
mostbet служба поддержки Кыргызстан чат mostbet служба поддержки Кыргызстан чат
mostbet akkaunt bloklandi mostbet akkaunt bloklandi
комплексное продвижение сайтов москва комплексное продвижение сайтов москва .
beste online wettseite
Feel free to visit my webpage – Basketball wetten nba
seriöse wettanbieter ohne oasis
Look at my homepage – gegen euro wetten (Bridgette)
mostbet hesabım açılmır mostbet hesabım açılmır
Sportwetten Anbieter Ohne Steuer online anbieter
internet seo internet seo .
sportwetten tippen
My web page; kombiwetten Heute
Статья про цены на накрутку позиций и выбор оптимального предложения. Автор рассказывает, на что обращать внимание, какие факторы влияют на стоимость и как не ошибиться с подрядчиком. Полезные рекомендации: https://spc2.ru/tseny-na-nakrutku-pozitsiy-v-poiskovyh-sistemah-kak-vybrat-optimalnoe-predlozhenie/
раскрутка и продвижение сайта раскрутка и продвижение сайта .
продвижение сайтов в москве продвижение сайтов в москве .
mostbet mobil saytdan istifadə mostbet mobil saytdan istifadə
продвижение в google продвижение в google .
1win blackjack 1win34861.help
продвижение наркологии продвижение наркологии .
seo agencies list seo agencies list .
частный seo оптимизатор частный seo оптимизатор .
мостбет коэффициенты футбол Кыргызстан мостбет коэффициенты футбол Кыргызстан
продвижение сайтов интернет магазины в москве продвижение сайтов интернет магазины в москве .
краш melbet melbet81573.help
esport buchmacher
Here is my blog – ergebnis wetten live
seo partners seo partners .
интернет агентство продвижение сайтов сео интернет агентство продвижение сайтов сео .
Jogo do Tigrinho multiplicador fixo vs aleatório: qual você prefere?
online Quote Wetten dass gestern in deutschland
PG Soft mobile 2026: melhor experiência no Android ou iOS? Conta sua opinião
1win rəsmi download 1win rəsmi download
1win bonus necə aktiv edilir 1win bonus necə aktiv edilir
заказать анализ сайта заказать анализ сайта .
мелбет лицензия http://melbet81573.help
Blackburn vs Preston 2026 Championship 21:00 Rovers favored
поисковое seo в москве поисковое seo в москве .
раскрутка сайта франция цена раскрутка сайта франция цена .
seo network seo network .