Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm using Apache and mod_proxy to provide access to the Monit GUI over HTTP. So far my configuration is as follows:

    ProxyRequests Off
    <Proxy *>
            Order deny,allow
            Allow from all
    </Proxy>
    ProxyPreserveHost on
    ProxyPass /monit http://localhost:2812/
    ProxyPassReverse /monit http://localhost:2812/

When people go to http://mywebsite/monit they do get the Monit home page. However the links returned by Monit have an absolute path, which breaks the proxy which is only applied to paths starting with /monit. I could create a separate vhost just for Monit (e.g. http://monit.mywebsite) which would fix the problem, but was wondering if there was another solution.

Q1: Is there a way to get Apache to rewrite links in HTML code to prepend whatever path is defined in the ProxyPass and ProxyPassReverse directive?

Q2: If above not possible, do you see another solution than the separate vhost I **mentioned?

share|improve this question

1 Answer 1

EDIT

Your proxy setup is slightly incorrect:

it should be:

ProxyRequests Off
<Proxy *>
        Order deny,allow
        Allow from all
</Proxy>
ProxyPreserveHost on
ProxyPass /monit http://localhost:2812
ProxyPassReverse /monit http://localhost:2812

notice the difference? In your setup you remove a / to many.

you could also go for

ProxyPass /monit/ http://localhost:2812/
ProxyPassReverse/ /monit http://localhost:2812/

but then requests to http://mywebsite/monit would not work, only to http://mywebsite/monit/ which would be kind of inconvenient.


OLD Response

Probably mod_proxy_html could do what you want but as far as I know it's never the best solution.... I don't know Monit but isn't there an option in it to make it only use relative paths?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.