You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Ananya Dey <an...@gmail.com> on 2019/01/29 11:13:22 UTC

[users@httpd] Use of ProxyPassReverse

Hi all,

I am trying to connect my Apache webserver with my backend tomcat server. I
am using ProxyPass to do the same. Is there a need to put ProxyPassReverse
also along with it? I am not able to understand the working functionality
of the two in depth. Could someone please elaborate on the same .

Thanks
Ananya

Re: [users@httpd] Use of ProxyPassReverse

Posted by Daniel Ferradal <df...@apache.org>.
Awesome explanation Matt!

El mar., 29 ene. 2019 a las 19:36, Muggeridge, Matt
(<ma...@hpe.com>) escribió:
>
> ProxyPassReverse is used for rewriting response headers related only to redirection.   As per the docs, it affects only “Location”, “Content-Location” and “URI” headers on HTTP redirect responses.
>
>
>
> The example they give is helpful (although cluttered with other concepts).  Here is a more crystalized version of the example and a protocol exchange for clarity.
>
>
>
> ProxyPass         "/mirror/foo/" "http://backend.example.com/"
> ProxyPassReverse  "/mirror/foo/" "http://backend.example.com/"
>
> If the backend server uses a redirect to some other location on the same backend server, the reverse-proxy rewrites the ‘redirect headers’ according to the ProxyPassReverse directive.
>
>
>
> Let’s say the backend.example.com uses the location header to redirect a request http://backend.example.com/bar to http://backend.example.com/quux.  The end-to-end protocol exchange looks something like (caveat: written without validating):
>
>
>
> Client Request:
>
> GET /mirror/foo/bar HTTP/1.1
>
> Host: example.com
>
>
>
> Reverse Proxy rewrites it to the backend (courtesy of the ProxyPass directive):
>
> GET /bar HTTP/1.1
>
> Host: backend.example.com
>
>
>
> Backend Server responds with a redirect using the location header:
>
> HTTP/1.1 302 Found
>
> Location: http://backend.example.com/quux
>
>
>
> Reverse Proxy Intervenes (courtesy of the ProxyPassReverse directive) and rewrites the Location header to be:
>
> HTTP/1.1 302 Found
>
> Location: http://example.com/mirror/foo/quux
>
>
>
> The client then reissues the request to the Location http://example.com/mirror/foo/quux and the Reverse Proxy forwards it onto http://backend.example.com/quux.
>
>
>
> Matt.
>
>
>
>
>
> From: Ananya Dey [mailto:ananyadey.95@gmail.com]
> Sent: Tuesday, 29 January 2019 9:13 PM
> To: users@httpd.apache.org
> Subject: [users@httpd] Use of ProxyPassReverse
>
>
>
> Hi all,
>
>
>
> I am trying to connect my Apache webserver with my backend tomcat server. I am using ProxyPass to do the same. Is there a need to put ProxyPassReverse also along with it? I am not able to understand the working functionality of the two in depth. Could someone please elaborate on the same .
>
>
>
> Thanks
>
> Ananya



-- 
Daniel Ferradal
HTTPD Project
#httpd help at Freenode

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] Use of ProxyPassReverse

Posted by "Muggeridge, Matt" <ma...@hpe.com>.
ProxyPassReverse is used for rewriting response headers related only to redirection.   As per the docs, it affects only “Location”, “Content-Location” and “URI” headers on HTTP redirect responses.

The example they give is helpful (although cluttered with other concepts).  Here is a more crystalized version of the example and a protocol exchange for clarity.


ProxyPass         "/mirror/foo/" "http://backend.example.com/"
ProxyPassReverse  "/mirror/foo/" "http://backend.example.com/"
If the backend server uses a redirect to some other location on the same backend server, the reverse-proxy rewrites the ‘redirect headers’ according to the ProxyPassReverse directive.

Let’s say the backend.example.com uses the location header<https://en.wikipedia.org/wiki/HTTP_location> to redirect a request http://backend.example.com/bar to http://backend.example.com/quux.  The end-to-end protocol exchange looks something like (caveat: written without validating):

Client Request:

GET /mirror/foo/bar HTTP/1.1

Host: example.com



Reverse Proxy rewrites it to the backend (courtesy of the ProxyPass directive):

GET /bar HTTP/1.1

Host: backend.example.com



Backend Server responds with a redirect using the location header<https://en.wikipedia.org/wiki/HTTP_location>:

HTTP/1.1 302 Found

Location: http://backend.example.com/quux

Reverse Proxy Intervenes (courtesy of the ProxyPassReverse directive) and rewrites the Location header to be:

HTTP/1.1 302 Found

Location: http://example.com/mirror/foo/quux

The client then reissues the request to the Location http://example.com/mirror/foo/quux and the Reverse Proxy forwards it onto http://backend.example.com/quux.

Matt.


From: Ananya Dey [mailto:ananyadey.95@gmail.com]
Sent: Tuesday, 29 January 2019 9:13 PM
To: users@httpd.apache.org
Subject: [users@httpd] Use of ProxyPassReverse

Hi all,

I am trying to connect my Apache webserver with my backend tomcat server. I am using ProxyPass to do the same. Is there a need to put ProxyPassReverse also along with it? I am not able to understand the working functionality of the two in depth. Could someone please elaborate on the same .

Thanks
Ananya