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.
Jogo do Tigrinho ao vivo no Pix: quem já sacou rápido?
1вин о деньги пополнение http://1win09451.help
melbet slot bonus melbet slot bonus
mostbet apk http://mostbet32854.help/
Online Wedden snooker wedden aanbieders
professioneel sportwedden
Also visit my page; android wedden voor geld 2026 –
https://FR-Betting.com -
мелбет зеркало скачать apk https://melbet30946.help
mostbet depozit bonus sport mostbet59402.help
1win aviator http://www.1win60278.help
мелбет рабочее зеркало киргизия мелбет рабочее зеркало киргизия
мелбет casino slots melbet30946.help
Hi friends, how is everything, and what you desire to say about this
article, in my view its genuinely awesome in support of me.
1вин crash http://1win09451.help
melbet app ne souvre pas melbet app ne souvre pas
мостбет восстановление аккаунта мостбет восстановление аккаунта
скачать youtube видео скачать youtube видео .
lucky jet игра мостбет lucky jet игра мостбет
melbet dépôt en attente melbet81256.help
1win-kg 1win09451.help
Fortune Tiger auto spin: quantos giros vocês costumam deixar rodando?
мостбет отзывы Киргизия мостбет отзывы Киргизия
Fortune Dragon novo lançamento PG Soft: já testou? Tá melhor que o Tigrinho?
1win кэшбек Кыргызстан http://1win09451.help/
melbet service client côte divoire https://melbet81256.help
мостбет скачать с официального сайта https://mostbet32854.help
virtuele virtuele wedden
Also visit my blog post: basketball-wetten.com
You have made some good points there. I looked on the internet for more info about the issue and found most people will go along with your views on this site.
1win slotlarda necə oynamaq olar http://www.1win60278.help
mostbetda bonusni qanday ishlatish mostbet59402.help
Discovered a comprehensive review site that actually tests with real deposits: betradarusa.com
mostbet Oʻzbekiston download https://mostbet59402.help/
1win yeni cihaz giriş http://1win60278.help/
mostbet пополнение банковской картой Кыргызстан mostbet пополнение банковской картой Кыргызстан
1win pentru ios 17 https://1win59213.help/
Hmm is anyone else encountering problems with the pictures on this blog loading? Im trying to figure out if its a problem on my end or if its the blog. Any feedback would be greatly appreciated. adult xxx video porn site xxx sex video
скачать видео из ютуб по ссылке скачать видео из ютуб по ссылке .
мостбет KGS счет http://www.mostbet70269.help
мелбет авиатор киргизия мелбет авиатор киргизия
I really love your site.. Pleasant colors &
theme. Did you make this website yourself? Please reply back
as I’m hoping to create my very own site and would love to learn where you got this from or exactly what the theme is called.
Thank you!
Bônus de cadastro PG Soft: qual site está dando o melhor bônus agora?
Jogo do Tigrinho 2026: quem está jogando com banca pequena?
cum verific soldul 1win 1win59213.help
melbet aviator mobile melbet aviator mobile
mostbet отзывы Киргизия mostbet отзывы Киргизия
1win apk Бишкек скачать http://1win09451.help
1win depunere cu maib card 1win depunere cu maib card
1win retragere bancara https://www.1win59213.help
Bônus sem depósito Fortune Tiger: qual site ainda libera?
melbet ставка на спорт киргизия melbet ставка на спорт киргизия
Не скажу, что идеал, но выглядит вполне адекватно: https://sksensation.ru/smm-prodvizhenie-v/