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.
hey there and thank you in your information ? I?ve definitely picked up anything new from proper here. I did then again experience several technical issues the usage of this website, since I skilled to reload the web site a lot of occasions previous to I may get it to load correctly. I were puzzling over if your web host is OK? No longer that I am complaining, however slow loading cases times will sometimes affect your placement in google and can harm your quality score if advertising and ***********|advertising|advertising|advertising and *********** with Adwords. Anyway I?m adding this RSS to my e-mail and can look out for a lot more of your respective interesting content. Ensure that you update this again soon..
Ayr?ca, eger seftali cekirdegi konusuyla ilgileniyorsan?z, buray? inceleyin. Kendiniz gorun: https://kendihobim.com/articles/seftali-cekirdegi-dikimi-adim-adim-rehber/
Testando horários no Treasures of Aztec e hoje de manhã foi o melhor. Stop-loss sempre em dia.
E aí galera, Fortune Dragon tá on fire no fim de semana. Saque de milzão já na conta.
Ayr?ca, eger mavi gri aras? renk konusuyla ilgileniyorsan?z, buray? inceleyin. Link burada: https://kendimacera.com/articles/mavi-gri-arasi-renk-anlam-ve-kullanimi/
Краткий отчет о текущих альфа-тестах секс лесбиянок с игрушками
Sessão rápida e lucrativa no Fortune Dragon. Nada como ver o saldo subir. Gestão é tudo.
Generally I don’t read post on blogs, but I wish to say that this write-up very forced me to try and do it! Your writing style has been surprised me. Thanks, very nice article.
It is my belief that mesothelioma is most lethal cancer. It contains unusual qualities. The more I really look at it the harder I am confident it does not work like a true solid flesh cancer. In case mesothelioma can be a rogue viral infection, in that case there is the chance for developing a vaccine along with offering vaccination for asbestos open people who are really at high risk of developing foreseeable future asbestos associated malignancies. Thanks for expressing your ideas for this important ailment.
Girei um pouco no Caishen Wins agora e já tô com R$ 500 no lucro.
Bu arada, eger kaktus cicegi anlam? konusuyla ilgileniyorsan?z, suraya bak?n. Suradan okuyabilirsiniz: https://hobielyazma.com/articles/kaktus-cicegi-anlami-ve-sembolleri/
По теме “Актуальные события и проблемы в Карелии сегодня”, там просто кладезь информации.
Вот, делюсь ссылкой:
https://media10.ru
Hi there to every one, since I am actually keen of reading this
website’s post to be updated daily. It consists of fastidious data.
Somebody essentially help to make seriously articles I would state. This is the very first time I frequented your website page and thus far? I amazed with the research you made to make this particular publish amazing. Magnificent job!
pronosticos app apuestas deportivas ecuador baloncesto
apuestas en casino online (https://es-betting.com/) deportivas
1 euro
rikstoto app trav
Review my webpage; basketball-wetten.com
Skin tags on the eyelids are small, soft, benign growths that can show
up on the fragile skin around the eyes.
radye temel uzerine dolgu hakk?ndaki makaleyi tavsiye ederim. Kendiniz gorun: https://yappendik.com/articles/radye-temel-dolgu-uygulama-gereksinimler/
s?v? diyeti nas?l yap?l?r hakk?ndaki yaz?y? gercekten begendim. Iste link: https://sporfikirleri.com/articles/haftalik-sivi-diyeti-temel-bilgiler-uygulama/
Tá soltando muita carta.
Bu arada soyleyeyim, eger ozan celik konusuyla ilgileniyorsan?z, buray? inceleyin. Suradan okuyabilirsiniz: https://dinamikstil.com/authors/ozan-celik/
Thank you, I have recently been searching for facts about this topic for ages and yours is the best I’ve located so far.
Improvement rates in various researches generally
have actually been around 50%.
“ekimde ne ekilir” konusu icin burada harika bilgiler var. Kendiniz gorun: https://hobiprojesi.com/articles/ekim-ayinda-hangi-bitkiler-ekilir/
We have been helping Canadians Get a Loan Against Their
Vehicle for Repairs Since March 2009 and are among the very
few Completely Online Lenders In Canada. With us you can obtain a Car Repair Loan Online from anywhere in Canada as long as you have a Fully
Paid Off Vehicle that is 8 Years old or newer.
We look forward to meeting all your financial needs.
A estratégia no Mines deu muito certo agora pouco.
gri renk nas?l elde edilir hakk?ndaki yaz?y? tavsiye ederim. Link burada: https://yapevinde.com/articles/gri-renk-nasil-yapilir/
Looking for the Best Drive School of Motoring? Get expert driving lessons at best driving school for affordable and quality driving instruction.
Между прочим, если вас интересует Свежие новости Бурятии: события и обновления, загляните сюда.
Вот, делюсь ссылкой:
https://tigir.com
Особенно понравился раздел про Инсайдерские истории из мира детско-юношеского спорта.
Ссылка ниже:
https://familykrasnodar.ru
Se tá buscando Tela Forrada, vai de Tigrinho. Peguei um absurdo de dinheiro agora pouco.
“tahta cesitleri” konusu icin cok faydal? bir yaz? buldum. Link burada: https://kendihobim.com/articles/mobilya-tahta-cesitleri-kullanim-alanlari/
По теме “Главные новости Чувашской Республики сегодня”, там просто кладезь информации.
Вот, делюсь ссылкой:
https://chy22media.ru
O Fortune Tiger tá pagando muito ontem à noite! Já fiz o PIX de R$ 50.
todays horseracing tips
my webpage New Online Horse Racing Betting Sites
online how does a place bet work in horse racing (Elwood) race betting app
wettanbieter lizenz
Check out my web blog … was bedeutet kombiwette (Verona)
bonus wetten
Visit my web-site; buchmacher ohne lugas (Bobbie)
Para quem tem dúvida, Porquinho é o canal. Top demais.
Ayr?ca, eger s?klamen cicegi nas?l cogalt?l?r konusuyla ilgileniyorsan?z, suraya bak?n. Iste link: https://kendiyolu.com/articles/siklamen-cicegi-cogaltma-rehberi/
Строительство домов Первый Строительный – это индивидуальный подход к каждому клиенту. Мы учитываем все ваши пожелания и предпочтения, чтобы создать дом, который будет идеально соответствовать вашему образу жизни и потребностям.
Подробнее – https://developers-novosibirsk.ru
строительные компании новосибирской области
ипотека от застройщика
строительство
wettquoten esc deutschland
Check out my site Wetten FüR Heute
sportwetten ergebnisse heute
My web-site; wettprognosen
zuverlässige wett tipps
my site … Buchmacher Hamburg
sportwetten bonus mit einzahlung
Here is my web-site – gewinner wetten dass (Wyatt)
Pretty section of content. I just stumbled upon your weblog and in accession capital to assert that I get in fact enjoyed account your blog posts. Anyway I will be subscribing to your augment and even I achievement you access consistently fast.
Кстати, если вас интересует Модернные тактики футбола: глубокий анализ, загляните сюда.
Смотрите сами:
https://liverpoolarmy.ru
O segredo do Spaceman é não ter ganância. Puxei milzão e parei.
“gri renk nas?l elde edilir” konusu icin burada harika bilgiler var. Kendiniz gorun: https://yapevinde.com/articles/gri-renk-nasil-yapilir/