Apache Web Server : ProxyPass and ProxyPassReverse

yapkm01 picture yapkm01 · Jun 11, 2012 · Viewed 9.8k times · Source

I have scanned through internet and also stackoverflow and i'm still not sure the purpose of proxypass and proxypassreverse.

Why do we need proxypass (instead of using mod_jk) for apache server to connect to tomcat?

Anyone please?

Answer

Yan Khonski picture Yan Khonski · Dec 4, 2017

The ProxyPassReverse is used to change the headers sent to Apache from a proxied app server, before Apache sends it to the browser.

For example, if the app sits on localhost:8080, it will respond with a redirect and location header of http://localhost:8080/new_path/, and Apache will take this and send it off to the browser. The browser will try to send a request to Page on localhost:8080 and receive an error.

ProxyPassReverse will intercept those headers, and rewrite them to match the Apache proxy server.

ProxyPass will create a reverse proxy. A reverse proxy (or gateway), appears to the client just like an ordinary web server. The client makes ordinary requests for content in the namespace of the reverse proxy. The reverse proxy then decides where to send those requests and returns the content as if it were itself the origin.

https://www.quora.com/Whats-the-difference-between-proxypassreverse-and-proxypass

https://httpd.apache.org/docs/2.4/mod/mod_proxy.html