1
I'm using Apache 2.4 reverse proxy to get remote access to my webcams. The reverse proxy is working fine.
- External URL:
http://example.com/camera1/home.asp
- Internal URL:
http://camera1/home.asp
However some links starting with /
—absolute URI from site root and not relative URI—are not correctly rewritten by the reverse proxy.
Instead of being rewritten like this:
http://example.com/camera1/script.js
They are rewritten like:
http://example.com/script.js
Which is preventing the application to work properly. This is simply because Apache is not able to identify the link I'm using mod_proxy
, mod_proxy_http
, mod_proxy_html
.
The automatic rewriting of the links provided by mod_proxy_html
for HTML, CSS can not work in this context because the missed links are inside a minified JavaScript (compacted with no space and no indentation)
There is no need to say I can't modify the software of my webcams.
However, I have identified patterns which I could apply to make the correction if I would know how to introduce a regex to be applied before sending the reply back to the client.
Is there any way to apply some post processing to the application answer?
My config looks like this:
ProxyRequests Off
ProxyPass /cam1/ http://cam1/
ProxyPassReverse /cam1/ http://cam1/
<Location /cam1/>
ProxyHTMLEnable On
ProxyHTMLExtended On
ProxyHTMLURLMap /cgi/ /cam1/cgi/
ProxyHTMLURLMap /advanced_data.asp /cam1/advanced_data.asp
</Location>
It is working fine for most of the situations, the response is correctly processed, I can see /cam1
which is added. But some scripts are not working.
What does your Apache reverse proxy config look like? Look at my general answer here on setting up an Apache reverse proxy for possible tips and ideas. But in general you might do some research on
– JakeGould – 2019-04-08T15:09:31.160mod_rewrite
specificallyRewriteMap
andRewriteRule
. Those options allow you to create regex for filtering URLs just the way you describe.I have added my reverse proxy configuration in my question<br>. If I'm correct the rewrite module is processing URLs only, not the response content – nico – 2019-04-08T23:23:17.960
Thanks for adding! Should help others if I cannot look at out later when I have time. But please do not use HTML or HTML entities in your posts here. Please read up on how this site use Markdown to format posts; utterly no need to add any of the HTML you have added.
– JakeGould – 2019-04-08T23:49:52.077