Re: How to prevent mod_proxy from rewriting redirects into absolute URLs?

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

 




On Mon, Nov 19, 2012 at 9:48 AM, Yang Zhang <yanghatespam@xxxxxxxxx> wrote:
I have: nginx (port 80) reverse-proxying to apache2 (port 88)
reverse-proxying to a web app (port 5001).

However, when the web app responds with a redirect like `Location:
/foo`, apache2 rewrites this into `Location:
http://host.com:88/sub/foo`,

Yes that's what reverse proxy is all about, it rewrites the Location header using ProxyPassReverseso it doesn't get bypassed in case of backend server redirection.

even though port 88 is publicly
inaccessible. I'd like it to just redirect to the relative URL
`Location: /sub/foo`.

So use a redirect then. Looks like reverse proxy is not applicable for your user case.
 

Any ideas?

My apache config (using mod_proxy_http, mod_proxy_html, mod_substitute):

      <Location /notes/>
        Allow from all
        ProxyPass http://127.0.0.1:5001/
        SetOutputFilter  proxy-html
        ProxyPassReverse /
        ProxyHTMLURLMap  /   /notes/
        RequestHeader unset Accept-Encoding
        AddOutputFilterByType SUBSTITUTE application/atom+xml
        Substitute "s|127.0.0.1:5001|host.com/notes|"
      </Location>

Thanks.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-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