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.
pixelroute.click – Content reads clearly, helpful examples made concepts easy to grasp.
rankpulse.click – Content reads clearly, helpful examples made concepts easy to grasp.
boostsignal.click – Loved the layout today; clean, simple, and genuinely user-friendly overall.
seo онлайн seo онлайн .
курсы seo курсы seo .
гидроизоляция инъектированием гидроизоляция инъектированием .
стоимость инъекционной гидроизоляции стоимость инъекционной гидроизоляции .
mejor pagina nuevas casas de apuestas españa (h5p.harryhr.nl) apuestas
Подбор кредита в Казахстане помогает найти оптимальное решение. Можно учитывать процент срок и размер платежа. Онлайн сервисы упрощают анализ предложений. Это снижает финансовые риски. Выбор становится более осознанным https://spisok-kreditov.ru/
https://vc.ru/1378530 – Накрутка просмотров в ТГ – ТОП-25 способов в 2026 году
инъекционная гидроизоляция стен инъекционная гидроизоляция стен .
инъекционная гидроизоляция гидрофобные смолы inekczionnaya-gidroizolyacziya-fundamenta.ru .
ремонт бетонных конструкций договор remont-betonnykh-konstrukczij-usilenie4.ru .
AWD electric cars use two or more motors to power all four wheels. This improves traction acceleration and stability in snow rain and off-road conditions – https://ev.motorwatt.com/ev-database/database-electric-cars/
Перекредитование в Казахстане подходит тем у кого несколько активных займов. Все кредиты можно объединить в один. Это помогает снизить общий платеж. Онлайн подбор кредита упрощает поиск нового предложения. Финансовая нагрузка становится более предсказуемой: https://spisok-kreditov.ru/08_refinansirovanie-kredita.html/
Накрутить Тик Ток лайки бесплатно – ТОП-20 сервисов в 2026 году https://vc.ru/1296056
Electric hypercars are ultra-high-performance EVs with extreme speed advanced aerodynamics and cutting-edge battery technology. They are built in limited numbers and often cost millions of dollars https://ev.motorwatt.com/ev-manufacturers/
инъекционная гидроизоляция промышленный объект inekczionnaya-gidroizolyacziya-fundamenta1.ru .
Как накрутить голоса в опросе – 25 надежных сервисов 2026 https://vc.ru/1400599
ремонт бетонных конструкций панельный remont-betonnykh-konstrukczij-usilenie4.ru .
полиуретановая инъекционная гидроизоляция inekczionnaya-gidroizolyacziya-fundamenta.ru .
Nissan electric vehicles include popular models like the Nissan Leaf and Ariya. They are known for affordability reliability and practical daily use: Polestar 3 2026
ремонт бетонных конструкций технология ремонт бетонных конструкций технология .
ремонт бетонных конструкций москва ремонт бетонных конструкций москва .
online sportwetten app
Review my web blog … Wetten England Schweiz
гидроизоляция подвала самара гидроизоляция подвала самара .
гидроизоляция подвала материалы гидроизоляция подвала материалы .
кухни на заказ в спб kuhni-spb-25.ru .
casa de apuestas handicap Como funciona (vuonhoaviet.Vn)
europa league
Кредит наличными в Казахстане подходит для личных целей. Деньги можно использовать без отчетности. Онлайн заявка позволяет получить решение удаленно. Условия зависят от суммы и срока. Такой формат удобен для повседневных расходов рефинансирование кредита казахстан
netamplify.click – Overall, professional vibe here; trustworthy, polished, and pleasantly minimal throughout.
leadcircuit.click – Overall, professional vibe here; trustworthy, polished, and pleasantly minimal throughout.
viralshift.click – Content reads clearly, helpful examples made concepts easy to grasp.
sitebloom.click – Navigation felt smooth, found everything quickly without any confusing steps.
brandfunnel.click – Loved the layout today; clean, simple, and genuinely user-friendly overall.
die besten wettanbieter
Feel free to visit my web page basketball-Wetten.com
wettbüro anbieter
Also visit my site … sportwetten vorhersage heute
internet wetten quoten
deutschland
кухня глория kuhni-spb-25.ru .
гидроизоляция подвала делать самостоятельно gidroizolyacziya-podvala-samara4.ru .
гидроизоляция подвала жилого дома гидроизоляция подвала жилого дома .
Куда лучше пойти служить по контракту на СВО Россия 2026 https://vc.ru/1689793
глория мебель kuhni-spb-25.ru .
кухни спб кухни спб .
кухня на заказ кухня на заказ .
кухни на заказ спб каталог кухни на заказ спб каталог .
заказ кухни спб kuhni-spb-31.ru .
кухни спб на заказ кухни спб на заказ .
ленинградские кухни kuhni-spb-28.ru .
гидроизоляция подвала грунтовые воды gidroizolyacziya-podvala-samara4.ru .