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.
Texture Travel Blog – Engaging and personal, articles bring destinations to life with vivid imagery.
digital store resource – Simple design and smooth checkout process made online shopping convenient.
trustedbusinesslinks – Guidance is clear, helped form professional partnerships quickly.
Creative Every Day – Fun and motivating, the site encourages regular creative exploration.
long-term business alliances – Actionable strategies that ensured stable growth and reliable partnerships.
workflowoptimizer – Made managing multiple projects much simpler and faster.
Mobihub supports advanced automation scenarios. The API allows integration with external tools. A Telegram bot provides quick control and notifications. Subscription management is handled in a personal dashboard. This creates a complete proxy management ecosystem: https://onlyfans.com/mobihub
trustedcoordinationhub – Easy-to-follow frameworks, significantly improved teamwork efficiency.
вывод из запоя на дому краснодар цены вывод из запоя на дому краснодар цены .
globalpartnershiphub – Networking advice is practical, alliance guidance helps manage connections efficiently.
dependablebuyinghub – Secure and trustworthy site, made online shopping quick and simple.
decision clarity resource – Useful perspectives that streamlined evaluating multiple options.
вывод из запоя бесплатно vyvod-iz-zapoya-krasnodar-2.ru .
bond management tools – Online bond oversight is simple and runs without issues.
изготовление кухни на заказ в спб kuhni-spb-32.ru .
нарколог на дом цены нарколог на дом цены .
dealsmart – Great selection and fast checkout, very user-friendly experience.
Vintage Fiat 500 site – Fun and well-structured, the content is appealing to classic car lovers.
прямые кухни на заказ от производителя kuhni-spb-28.ru .
digitalmarketplace – Very intuitive, purchasing items online was seamless.
Ideas & Solutions – Insightful and approachable, the site helps simplify complex problems.
Basic but fast site – Straight to the point, the content shows up quickly.
запоминаемость рекламы reklamnyj-kreativ4.ru .
strategic collaboration roadmap – Useful guidance enhanced alignment, communication, and shared success.
улучшение креативов улучшение креативов .
strategictrustportal – Provides actionable solutions, very well-aligned with our company objectives.
skillboostlibrary – Helpful resources here, improved my skills efficiently and smoothly.
business foresight page – Thoughtful planning guidance that improved long-term goal alignment.
7k casino сочетает доступность и функциональность. Игровая платформа проста в использовании. Все элементы логично расположены. Игры запускаются быстро. Это делает сервис удобным: 7к казино вход
pathwaynavigator – Guidance that provided clarity on complex career choices.
вывод из запоя на дому краснодар цены вывод из запоя на дому краснодар цены .
pferderennen leipzig wetten
my website … Erfolgreiche Sportwetten Strategie (https://howtodatewithstyle.com/)
trusted deal hub – The marketplace feels reliable and finding good offers was quick and simple.
1win лайв казино Кыргызстан http://1win12050.ru/
быстрый анонимный вывод из запоя на дому vyvod-iz-zapoya-krasnodar-2.ru .
shoppinghub – Great deals, very simple and hassle-free checkout.
Live cricket schedule – Very practical, fixtures and timelines are kept up-to-date.
gute wettseiten
Visit my website … Alle Wettanbieter In Deutschland
wette spielen
Look at my blog; buchmacher Kappe
trustedallianceshub – Helpful suggestions, made building strong partnerships easier and more organized.
professionalconnectportal – Makes working with teams smooth and effective, very easy to use.
Прикладные навыки – значение и роль в контексте контракта на СВО Россия 2026 https://vc.ru/1583781
мебель для кухни спб от производителя kuhni-spb-32.ru .
врач нарколог на дом платный narkolog-na-dom-krasnodar-1.ru .
кухни на заказ санкт петербург кухни на заказ санкт петербург .
valuepartnershipnetwork – Useful partnership guidance, made enterprise decision-making easier.
worklink – Straightforward tools, streamlined communication across all departments.
ТОП-25 сервисов для накрутки подписчиков в Инстаграм 2026 https://vc.ru/1560169
Suiruan H5 digital hub – Interesting flow, the site invites further exploration.
Просмотр сторис Инстаграм – 25 способов накрутки в 2026 году Подробности доступны для ознакомления https://vc.ru/1499536