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.
Привет всем Как выбрать проект дома под ключ для участка в Дагестане Надежность дома во многом зависит от качества фундамента и конструкций. Мы выполняем фундаментные работы с учетом особенностей грунта что обеспечивает устойчивость здания на долгие годы. Полная информация по ссылке – https://dagtechstroy.ru/igor-p/ панели для строительства дома строительство кирпичных домов заказать гнб расшифровка в строительстве строительство коттеджей цена Игорь П. – ДагТехСтрой – строительство екатеринбург колледж транспортного строительства Удачи и комфорта в жизни Как выбрать проект дома под строительство 35ffc69
pin-up yuklab olish qanday http://www.pinup39174.help
Кстати, если вас интересует Страница не найдена: что делать дальше?, загляните сюда.
Смотрите сами:
https://09media.ru
I have read so many content on the topic of
the blogger lovers however this piece of writing
is actually a fastidious article, keep it up.
Кстати, если вас интересует Живые обзоры и прогнозы футбольных матчей, загляните сюда.
Смотрите сами:
https://livetottenham.ru
the streamer scene started tagging Fortune Rabbit sessions by intent: test, real, target.
pinup plinko o‘yin http://pinup39174.help
Почему пользователи выбирают площадку
KRAKEN?
Маркетплейс KRAKEN заслужил доверие многочисленной аудитории благодаря
сочетанию ключевых факторов.
Во-первых, это широкий и разнообразный ассортимент,
представленный сотнями продавцов.
Во-вторых, интуитивно понятный интерфейс
KRAKEN, который упрощает навигацию, поиск
товаров и управление заказами даже для
новых пользователей. В-третьих, продуманная
система безопасных транзакций, включающая механизмы разрешения споров (диспутов)
и возможность использования условного депонирования, что
минимизирует риски для обеих сторон сделки.
На KRAKEN функциональность сочетается с внимательным отношением к
безопасности клиентов, что делает процесс покупок более предсказуемым, защищенным и, как следствие, популярным среди пользователей, ценящих анонимность и надежность.
I love your blog.. very nice colors & theme. Did you create
this website yourself or did you hire someone to do it for
you? Plz answer back as I’m looking to create my own blog and would
like to find out where u got this from. cheers
mostbet Azərbaycan aktual mirror http://mostbet2015.help
Hi there, I enjoy reading all of your article post. I like to write a little comment to support you.
mostbet status retragere https://mostbet40596.help
1win AZE https://1win64218.help
mostbet rychlý bankovní převod https://mostbet32570.help/
Wow, this article is pleasant, my sister is analyzing these kinds of things,
therefore I am going to let know her.
https://tr88.lat/
This is very interesting, You’re a very skilled blogger.
I’ve joined your feed and look forward to seeking more
of your excellent post. Also, I’ve shared your site in my
social networks!
I am extremely inspired with your writing talents as well as with the structure
in your blog. Is this a paid subject or did you modify it
your self? Anyway keep up the nice quality writing, it is
rare to see a great weblog like this one today..
скачать 1win на айфон скачать 1win на айфон
Wild Wild Riches showed strength on calculated entries.
Особенно понравился материал про Последние новости и обзоры кино на Лорд Фильмов.
Вот, можете почитать:
https://domflat.ru
mostbet app helyett böngésző mostbet app helyett böngésző
melbet promotii https://melbet07892.help/
Добрый день Ремонт квартиры с использованием экологичных материалов — это ваш шанс создать уютное и безопасное пространство. Мы выполняем ремонт квартиры с использованием экологичных материалов что обеспечит не только красоту но и заботу о здоровье. Ремонт квартиры с использованием экологичных материалов — это стиль и экология. Ремонт квартиры с использованием экологичных материалов — это забота о будущем. Ремонт квартиры в Москве — это возможность обновить пространство с учетом самых высоких стандартов. Мы выполняем ремонт квартиры в Москве предлагая индивидуальные решения для каждого клиента. Ремонт квартиры в Москве — это качественная работа с гарантией. Ремонт квартиры в Москве — это профессионализм и внимание к деталям. Больше информации по ссылке – https://betonpro100.ru/obsuzhdeniya/tehnicheskij-dizajn-proekt-klyuch-k-uspeshnoj-realizaczii-lyubogo-interera ремонт квартиры спб дом ремонта самара каталог отделки домов сайдинг для наружной дома цена капитальный ремонт перечень домов квартира с отделкой в москве в новостройке использованных при ремонте бани Удачи
Pre-session checklists are circulating across the discord groups.
Hi there this is somewhat of off topic but I was wondering if blogs use WYSIWYG editors or if you have
to manually code with HTML. I’m starting a blog soon but have no coding skills so I wanted to get advice from
someone with experience. Any help would be greatly appreciated!
Здравствуйте Почему игнорирование ТО приводит к авариям Плановое техническое обслуживание оборудования позволяет контролировать его состояние и предотвращать серьезные поломки. Регулярные проверки и замена изношенных деталей обеспечивают стабильную работу. Полная информация по ссылке – https://dagtechservice.ru/services/ учебник монтаж промышленного оборудования сервисное обслуживание промышленного оборудования порядок монтажа промышленного оборудования монтаж оборудования на производстве Услуги – Технический сервис монтаж промышленного оборудования учебник Удачи и комфорта в жизни Что делать если оборудование работает нестабильно 966bd10
mostbet notificări bonus https://mostbet40596.help
mostbet výběr čeká https://mostbet32570.help/
1win tətbiq donur http://1win64218.help
mostbet kartdan çıxarış vaxtı https://www.mostbet2015.help
Fortune Tiger stays as the main showcase of the moment.
mostbet verificare cont http://www.mostbet40596.help
mostbet náhradní odkaz mostbet náhradní odkaz
1win lucky jet oyunu https://1win64218.help
mostbet licență https://mostbet40596.help/
mostbet vklad paysafecard http://mostbet32570.help/
1win qaydalar https://1win64218.help
lucky jet skachat lucky jet skachat
mostbet pul köçürmə tarixçəsi https://mostbet2015.help/
mostbet promó kód Magyarország mostbet promó kód Magyarország
Привет всем любителям кино тогда я нашёл кое-что интересное Качество звука в фильме играет не менее важную роль чем качество изображения. Хорошая аудиодорожка помогает глубже погрузиться в атмосферу и почувствовать эмоции героев. сериалы бесплатно Многие онлайн-сервисы предлагают объемный звук для полного эффекта присутствия. Почувствуйте каждый шорох и каждую ноту. Ссылка на ресурс: — http://www.filmy-serialy-online-1.top сериалы онлайн бесплатно и безбесплатные фильмы на русскомновые фильмы 2025 смотреть Надеюсь это будет чем-то полезным
melbet reguli melbet07892.help
1win официальный вход с компьютера 1winkg.in.net
что такое 1win 1winkg.in.net
A player entered with a small PayPal bankroll and left in profit without raising risk.
Tournament leaderboards on Fortune Rabbit are filled with steady-volume players.
That is a very good tip particularly to those new to the blogosphere.
Short but very accurate info… Thank you for sharing this one.
A must read article!
kombiwette
Visit my page: basketball-Wetten.com
mostbet magyar nyelv beállítás https://www.mostbet2022.help
turnee aviator melbet https://www.melbet07892.help