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.
интернет маркетинг агентство интернет маркетинг агентство .
наборы суши с доставкой спб недорого наборы суши с доставкой спб недорого .
1win dəstəyə yazmaq http://1win5764.help/
mostbet скачать android http://mostbet34518.help
компании сео seo-prodvizhenie-reiting.ru .
услуги продвижения seo рязань timoly.ru сеотика.рф prodvizhenie-sajtov-po-trafiku10.ru .
gaming club casino headquarters (Lenora) usa login, united
statesn online casino legal and gambling trends usa, or best usa poker apps
mostbet sayt region səhvi https://www.mostbet85214.help
поисковое продвижение по трафику поисковое продвижение по трафику .
1win məzənnə 1win məzənnə
mostbet versiya uyğun deyil http://mostbet85214.help/
мелбет промокод http://melbet39518.help
google посещаемость сайта google посещаемость сайта .
как продавать сайты как продавать сайты .
продвижение сайта топ 1 seo-prodvizhenie-reiting.ru .
melbet descarcare aplicatie ios http://www.melbet75891.help
Коллеги, вопрос к тем, кто в высококонкурентных темах. Ситуация: сайт вылизал до блеска, а конкуренты в топе как сидели, так и сидят. Подозреваю, что без накрутки ПФ там не обошлось. Почитал тут статью, как раз чтобы понять масштабы: https://workspace.ru/blog/nakrutka-povedencheskih-faktorov-kak-nakrutit-pf_2/ . Оказывается, это целая индустрия с серверами, базами отпечатков и бюджетами от 15 тысяч в месяц. Автор прямо пишет, что в некоторых нишах накрутка стала необходимостью. Грустно, но теперь хоть понимаю, с чем имеем дело.
melbet bonus Republica Moldova http://www.melbet75891.help
мостбет ставки Кыргызстан https://mostbet34518.help
закупка ссылок в гугл заказать услугу агентство закупка ссылок в гугл заказать услугу агентство .
продажа сайта kak-prodat-sajt-1.ru .
интернет маркетинг агентство интернет маркетинг агентство .
раскрутка сайтов интернет prodvizhenie-sajtov-po-trafiku11.ru .
mostbet Ош mostbet Ош
melbet kz скачать приложение последняя версия https://melbet39518.help/
лучшие seo компании лучшие seo компании .
топ сео сайтов seo-prodvizhenie-reiting.ru .
создать сайт прогнозов на спорт в москве создать сайт прогнозов на спорт в москве .
купить готовый сайт kak-prodat-sajt.ru .
мелбет отмена вывода melbet39518.help
1win free bet offer 1win free bet offer
melbet kz купон ставок melbet39518.help
В статье подробно разбирается, за счёт чего локальный бизнес может выиграть у федералов. Автор выделяет слабые стороны крупных игроков (низкая адаптация под регион, медленная реакция) и показывает, как этим пользоваться. Есть примеры локальных ключей и советы по работе с Яндексом. Рекомендую: https://lefmun.ru/stati/bitva-za-ural-kak-lokalnomu-biznesu-iz-ekaterinburga-vyigrat-u-federalnyh-gigantov-v-poiske/
mostbet download Česko android http://mostbet2017.help/
купить готовый сайт kak-prodat-sajt-1.ru .
seo top agencies reiting-seo-kompanii.ru .
melbet retragere card bancar melbet retragere card bancar
buchmacher quotenvergleich
my site :: basketball wm 2023 Wetten
mostbet sport cashback http://www.mostbet02894.help
wett vorhersagen heute
Feel free to surf to my page; deutsche buchmacher, Curt,
1win mirror not working 1win mirror not working
аукцион сайтов аукцион сайтов .
mostbet legální v Česku mostbet legální v Česku
1win app download android http://1win5524.ru/
wie funktionieren live wetten Dass Heute
1win site mirror http://1win5524.ru
поисковое продвижение москва профессиональное продвижение сайтов поисковое продвижение москва профессиональное продвижение сайтов .
mostbet crash mobil http://www.mostbet2017.help
mostbet vklad bitcoin http://mostbet2017.help/
mostbet bonus hesablanmır https://mostbet85214.help/