0

I am trying to put an old Tomcat behind an Apache HTTPS reverse proxy. I configured the https virtual host to perform the actual proxying and the http virtual host to redirect everything to https:

https snippet:

ProxyRequests Off

ProxyPass           /old_app/       http://192.168.1.18:8080/old_app/
ProxyPassReverse    /old_app/       http://192.168.1.18:8080/old_app/

http snippet:

RewriteEngine On

RewriteCond %{HTTPS} !=on

RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

The problem is that the website shows up, but there are no CSS or images. If inspect using Chrome Developer Console I see a lot of errors regarding mixed content, that are blocked because originally referred in http. I searched around and I found some suggestions regarding modifying the proxied website, but in my situation I can not modify the Tomcat webapp. Is there a way to solve this problem? Or the only way is modify old_app source code? Maybe switching to Nginx with some particular configurations?

J.B.
  • 315
  • 8
  • 23

1 Answers1

0

Rewrite HTML so you can change the scheme from HTTP to HTTPS

You are looking for mod_proxy_html

The proxy itself has no way to rewrite the HTML that contains scheme, domain, or url. This module allows you to rewrite these on the fly.

Aaron
  • 2,859
  • 2
  • 12
  • 30
  • Thanks for the suggestion, but I had no luck...I added `ProxyHTMLEnable On SetOutputFilter proxy-html ProxyHTMLExtended On ProxyHTMLURLMap http://example.com https://example.com` But I still receive errors like: The page at `https://example.com/old_app/jsp/index.jsp` was loaded over HTTPS, but requested an insecure stylesheet `http://example.com/old_app/css/jquery.autocomplete.css`. This request has been blocked; the content must be served over HTTPS. – J.B. Feb 26 '17 at 19:32