ProxyHTMLURLMap not rewriting URLs the right way

1.8k views Asked by At

I have a Web-IRC-Client (The Lounge) running at http://www.example.com:3000/ (no HTTPS) and visiting the link works fine. When I specify the port I can use the Web-Client without any problems. Now, I don't want to type the port every time and that's why I am trying to setup a reverse proxy using Apache2's configuration file. The problem is that the client is loading the assets (CSS, JS, images) from the wrong location. See below for more info. I think ProxyHTMLURLMap is the right way of fixing it, but cannot get it to work. I should also note, that I am redirecting all non-www-http traffic to the www-https version.

<VirtualHost *:443>
[...]

  SSLProxyEngine on
  ProxyPass /irc http://www.example.com:3000/
  ProxyPassReverse /irc http://www.example.com:3000/
  ProxyHTMLURLMap http://www.example.com:3000/ /irc
</VirtualHost>

When I visit https://www.example.com/irc I just get the text of the website with my javascript, css, etc. Checking the source code reveals, that it is trying to load the assets from:

https://www.example.com/css/bootstrap.css

Which is wrong. It should, instead, be loading from:

https://www.example.com/irc/css/bootstrap.css

Any advice would be greatly appreciated!


EDIT 1: Some more info: Browsing to the https proxy with a slash at the end (https://www.example.com/irc/) kind of works. The images and CSS get loaded, but the client itself doesn't respond and shows "This is taking longer than it should, there might be connectivity issues." even though everything is up.

EDIT 2: Another user suggested adding ProxyHTMLExtended On, but it didn't help either.

1

There are 1 answers

0
Limon On

Even though this question is very old, I want to leave this here:

https://serverfault.com/a/685326

Note: If it's still not working, you might add to your config:

ProxyHTMLEnable On