{"id":176,"date":"2009-02-05T19:24:15","date_gmt":"2009-02-05T18:24:15","guid":{"rendered":"http:\/\/blog.pczone.be\/?p=176"},"modified":"2009-02-05T13:35:38","modified_gmt":"2009-02-05T12:35:38","slug":"tomcat-non-ssl-behind-apache-ssl","status":"publish","type":"post","link":"https:\/\/blog.pczone.be\/?p=176","title":{"rendered":"Tomcat non SSL behind Apache SSL"},"content":{"rendered":"<p>First let me explain our setup. In front we have a Apache 2.2 with SSL. Our users can access the site using http. A certain URL is mapped to a Tomcat running in the background. This mapping was done using mod_proxy. In the beginning I had to enable the preserverhost option. Otherwise the request.getRequestURL() is the request Apache made to the Tomcat.<\/p>\n<p>Today I had to install a SSL certificate (signed by Verizon). The configuration was actually straightforward and after a restart I checked the main page and everything was working. Then I tried loging in and suddenly I was back to plain http. Hmmm strange, so I checked my code. After login I did a redirect (using Spring MVC &#8220;redirect:\/&#8221;). After some googling I found a setting that would help <strong>RequestHeader set Front-End-Https &#8220;On&#8221;<\/strong><\/p>\n<p>(Don&#8217;t forget to include the headers module!) After a restart it still didn&#8217;t work, after fiddling around with my settings I found the solution. It seems if you combine the RequestHeader setting with the ProxyPreserveHost this doesn&#8217;t work. If you disable the ProxyPreserveHost setting but leave the RequestHeader enabled everything is working fine. The problem now is that your request.getRequestURL() is not the URL your customer is using. Luckily I could solve this by doing request.getHeader(&#8220;referer&#8221;) note that this probably won&#8217;t work in every situation (but in our case it does). Hopes this helps some people who are searching for the same solution.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>First let me explain our setup. In front we have a Apache 2.2 with SSL. Our users can access the site using http. A certain URL is mapped to a Tomcat running in the background. This mapping was done using mod_proxy. In the beginning I had to enable the preserverhost option. Otherwise the request.getRequestURL() is &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.pczone.be\/?p=176\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Tomcat non SSL behind Apache SSL&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"enabled":false},"version":2}},"categories":[4],"tags":[],"class_list":["post-176","post","type-post","status-publish","format-standard","hentry","category-informatics"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p3U9nk-2Q","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/blog.pczone.be\/index.php?rest_route=\/wp\/v2\/posts\/176","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.pczone.be\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.pczone.be\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.pczone.be\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.pczone.be\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=176"}],"version-history":[{"count":1,"href":"https:\/\/blog.pczone.be\/index.php?rest_route=\/wp\/v2\/posts\/176\/revisions"}],"predecessor-version":[{"id":177,"href":"https:\/\/blog.pczone.be\/index.php?rest_route=\/wp\/v2\/posts\/176\/revisions\/177"}],"wp:attachment":[{"href":"https:\/\/blog.pczone.be\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=176"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.pczone.be\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=176"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.pczone.be\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=176"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}