How does ProxyPassReverse work?
am 04.02.2010 16:55:54 von Rainer Frey
Hi,
I don't really understand the ProxyPassReverse directive, esp. the url parameter.
What exactly is the url matched against, in order for the rewrite to work?
The doc says:
| path is the name of a local virtual path. url is a partial URL for the remote
| server - the same way they are used for the ProxyPass directive.
I originally thought that the "partial URL for the remote server" means that I
should use the same URL as for the proxy worker. But some cases I encountered
seem to suggest that I need to use exactly the URL that is in the Location header.
The example is:
Env (from a rewrite map lookup): BACKEND=target.example.com:80/application
ProxyPass /somename/ http://${BACKEND}/ interpolate
ProxyPassReverse /somename/ http://${BACKEND}/ interpolate
The Backend server sends a redirect to
http://target.example.com/application/some-resource (without ':80'), and Apache
returns this redirect to the client. If I remove the port from the ProxyPassReverse
url the redirect is correctly rewritten.
So am I right that I need to exactly match the Location header from the backend?
And is there any configuration that influences whether two equivalent urls in
different form(such as :80 vs. no port) match?
Thanks
Rainer
------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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: How does ProxyPassReverse work?
am 04.02.2010 17:37:30 von Nick Kew
On Thu, 4 Feb 2010 16:55:54 +0100
"Rainer Frey" wrote:
> So am I right that I need to exactly match the Location header from the backend?
> And is there any configuration that influences whether two equivalent urls in
> different form(such as :80 vs. no port) match?
You need to match the start of the URL returned by the backend,
either exactly or with a regexp. So if your backend sends :80
then you need to match :80, and if it omits the port you
need to match that. An easy workaround in many cases is that
if you omit the slash, then you match the domain name both
with and without :80 alike.
Making that smarter is not as easy as it looks, because not
every redirect is to HTTP, or even to any standard protocol.
--
Nick Kew
------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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: How does ProxyPassReverse work?
am 05.02.2010 08:59:47 von Rainer Frey
On Thursday 04 February 2010 17:37:30 Nick Kew wrote:
> On Thu, 4 Feb 2010 16:55:54 +0100
>
> "Rainer Frey" wrote:
> > So am I right that I need to exactly match the Location header from the
> > backend? And is there any configuration that influences whether two
> > equivalent urls in different form(such as :80 vs. no port) match?
>
> You need to match the start of the URL returned by the backend,
> either exactly or with a regexp.
> So if your backend sends :80
> then you need to match :80, and if it omits the port you
> need to match that.
Thanks for the precise information. I understand now.
Rainer
------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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