Re: ProxyPass/ProxyPassReverse: url is not translated

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Jan 11, 2008 4:55 AM, Mike Wang <comritesecurity@xxxxxxxxx> wrote:
> Hi
>    I have tried to use proxypass with virtual host, here is what I want to do:
>
>   on server A,  virutal host :http://groups.mygroups.com/
>   on Server B:  a application is running at at: http://192.168.0.21/groups/
>
>    I want server A to do the reverse proxy to server B,
>    that mean http://groups.mygroups.com/  ==> http://192.168.0.21/groups/
>
>    And my configure on Server A is:
>
> <VirtualHost *:80>
>   ServerName  groups.mygroups.com
>   ProxyPass / http://192.168.0.21/groups/
>   ProxyPassReverse /  http://192.168.0.21/groups/
>   ProxyPreserveHost On
> </VirtualHost>
>
>
>   The issue is:
>
>      when I tried to access http://groups.mygroups.com/, the first
> home page showed up,
>      but on this page, there are links like:
>             http://192.168.0.21/groups/show.php etc
>
>     these links has not being translated to:
>             http://groups.mygroups.com/show.php
>
>     I tried other configures:
>         ProxyHTMLURLMap http://192.168.0.21/groups/ /
>
>       No luck.
>
>
>      anything could be wrong?

ProxyPassReverse only tells your webserver to replace
http://192.168.0.21/groups/ with http://groups.mygroups.com/ in
redirects your backend might generate. This does not change the
content of the response.

Your problem is that your backend produces content with absolute links
in it, referring to itself. This conent is passed on to your
webbrowser without change. You can solve this problem in several ways.
- Configure your backend to use http://groups.mygroups.com/ as base
url when it generates URLs.
- Or better: configure your backkend to use relative URLs only.

But for this you'll have to consult the documentation of your backend.
In short: when a webapp lives behind a proxy it often needs to be
configured as if it was actually _on_ that proxy.

As a last resort you can use output filtering using proxy_html see:
http://www.apachetutor.org/admin/reverseproxies (read this, especially
the part Fixing HTML)

you will need at least the following directives:
LoadModule proxy_http_module modules/mod_proxy_http.so
SetOutputFilter proxy-html
ProxyHTMLURLMap http://192.168.0.21/groups/ /

If this doesn't work increase the verbosity of your logs,
ProxyHTMLLogVerbose On
LogLevel  Debug

Krist

-- 
krist.vanbesien@xxxxxxxxx
krist@xxxxxxxxxxxxx
Bremgarten b. Bern, Switzerland
--
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux