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.
onlineshophub – Streamlined interface, purchasing items online was quick and stress-free.
corporatebondportal – Insightful and clear guidance, excellent for planning business investments.
https://vc.ru/1317989 Накрутка лайков Инстаграм бесплатно: ТОП-20 сервисов в 2026 году и способы
Сайт для накрутки подписчиков в ТГ – Эксклюзивно ТОП-20 в 2026 году https://vc.ru/2250511
knowledge toolkit page – Actionable tips that helped absorb information quickly and effectively.
longtermbizconnections – Great resource for forming trustworthy and effective business partnerships.
strategicroadmaps – Insightful explanations, made business strategy planning much faster.
The Gardens AL Updates Hub – Serene and helpful, community information is straightforward to follow.
careeradvancementhub – Advice here is insightful, really enhanced my career decision-making.
business alliance insights – Clear recommendations for expanding professional alliances.
learningprogressportal – Materials are easy to follow, helped me advance my knowledge effectively.
Накрутка подписчиков на Ютуб – ТОП 25 лучших сервисов и способов для бесплатной накрутки https://vc.ru/1500259
business foresight tips – Useful planning concepts that made future goals easier to outline.
Mobihub offers a convenient way to run a mobile proxy farm. Multiple Android devices can be connected and managed easily. The service supports traffic splitting with Wi-Fi networks. This helps optimize mobile data usage. The system remains stable under high loads: proxy service provider
safecommercehub – Platform is reliable, made online shopping quick and easy.
Learn & Improve Hub – Clear and encouraging, content inspires meaningful daily progress.
ленинградские кухни kuhni-spb-32.ru .
вывод из запоя бесплатно vyvod-iz-zapoya-krasnodar-1.ru .
вывод из запоя стационар краснодар vyvod-iz-zapoya-krasnodar-2.ru .
Wellspring massage info – Relaxed presentation, the information is both clear and supportive.
сервис анализа креативов сервис анализа креативов .
анализ баннеров reklamnyj-kreativ5.ru .
нарколог на дом цены нарколог на дом цены .
marketingideashub – Ideas provided are creative, helped our team design campaigns quickly.
strategicpartnerportal – Very actionable partnership advice, perfect for driving growth.
global partnership guide – Practical strategies that supported building connections across regions.
купить кухню купить кухню .
trusted ecommerce place – Purchasing was fast and the system handled everything cleanly.
smartcommerce – Modern design and intuitive workflow, enhanced my retail experience.
Travis Anderson Handmade – Stunning work, every item feels carefully crafted and genuine.
businessbondinginsights – Advice on networking is excellent, strengthened professional ties efficiently.
instantfind – Super easy to use, completed my shopping quickly.
networkingsphere – Easy to navigate and find potential business collaborators.
business sustainability hub – Clear advice that guided better long-term joint ventures.
worldtrustnetwork – Networking is simple and effective, platform feels modern and professional.
reliablepurchasehub – Clean interface, very straightforward to shop online today.
Inspire & Motivate – Encouraging and approachable, content makes change feel simple and exciting.
online market safety guide – Shopping and checkout were fast, smooth, and secure.
вывод из запоя цена краснодар vyvod-iz-zapoya-krasnodar-1.ru .
businessbondshub – Advice is straightforward and practical, simple to follow.
вывод из запоя в стационаре краснодара vyvod-iz-zapoya-krasnodar-2.ru .
глория мебель kuhni-spb-32.ru .
врач нарколог на дом платный narkolog-na-dom-krasnodar-1.ru .
купить кухню купить кухню .
RenovSystem bath hub – Informative and tidy, product details are easy to interpret.
careeradvancementguide – Useful learning platform, helped me strengthen professional skills quickly.
reliablebusinessbonding – Reliable corporate networking, very easy to manage and connect with teams.
точность прогноза креативов 95 reklamnyj-kreativ4.ru .
машинное обучение креативы reklamnyj-kreativ5.ru .
securemarketplace – Smooth experience, all transactions completed without any issues.