You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Mike Wang <co...@gmail.com> on 2008/01/11 04:55:49 UTC

[users@httpd] ProxyPass/ProxyPassReverse: url is not translated

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?


thanks.


-- 
Best Regards

Mike

---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] ProxyPass/ProxyPassReverse: url is not translated

Posted by Mike Wang <co...@gmail.com>.
Hi krist
    thanks  a lot.

> 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/ /
>

    this fixed the problem! :)

-- 
Best Regards

Mike

---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] ProxyPass/ProxyPassReverse: url is not translated

Posted by Krist van Besien <kr...@gmail.com>.
On Jan 11, 2008 4:55 AM, Mike Wang <co...@gmail.com> 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@gmail.com
krist@vanbesien.org
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org