Avatar of beer9
beer9
Flag for India asked on

what is the difference of ProxyPass and ProxyPassReverse as a configuration in Apache Web Server?

Hello, I would like to understand the difference of ProxyPass and ProxyPassReverse as a configuration in Apache Web Server?

I see something like this in my httpd.conf. Why should I have same URL for ProxyPass and ProxyPassReverse. Can not I just put ProxyPass directive?

ProxyPass http://apps.i-mycompany.com/apps/dashboard
ProxyPassReverse http://apps.i-mycompany.com/apps/dashboard

Open in new window

Apache Web Server

Avatar of undefined
Last Comment
LajuanTaylor

8/22/2022 - Mon
LajuanTaylor

Please see the APACHE documentation:
http://httpd.apache.org/docs/2.4/mod/mod_proxy.html

Documentation states:
"The forward proxy is activated using the ProxyRequests directive. Because forward proxies allow clients to access arbitrary sites through your server and to hide their true origin."

"A reverse proxy (or gateway), by contrast, appears to the client just like an ordinary web server. No special configuration on the client is necessary. "

"A reverse proxy is activated using the ProxyPass directive or the [P] flag to the RewriteRule directive. It is not necessary to turn ProxyRequests on in order to configure a reverse proxy."
beer9

ASKER
I am still not getting, above says: ProxyPass directive is used in both forward proxy an reverse proxy. If I have following in my httpd.conf then it's forward proxy or reverse proxy:

ProxyPass http://apps.i-mycompany.com/apps/dashboard
ProxyPassReverse http://apps.i-mycompany.com/apps/dashboard

Open in new window

LajuanTaylor

How are you using the server? Answering this question will actually help to make sense of what modules and features you decide to use. Also, what version of APACHE and OS are you running on? I'm speaking from a Windows Server perspective with APACHE.

ProxyPass
The directive ProxyPass allows remote servers to be mapped into the space of the local server; however, the local server does not act as a proxy in a traditional sense.  It appears to be a mirror of the remote server.  For example,

Suppose your  local server has an address of - http:/i-mycompany.com/; then
ProxyPass  /apps/dashboard/ http://apps.i-mycompany.com/apps/dashboard

will cause a local request for the <http:/i-mycompany.com/apps/dashboard> to be internally converted into a proxy request to <http://apps.i-mycompany.com/apps>
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
ASKER CERTIFIED SOLUTION
LajuanTaylor

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
LajuanTaylor

Here's a great article that discusses when a ProxyPass and ProxyPassReverse aren't enough they should be used in conjunction with mod_proxy_html
http://brian.olore.net/wp/2013/07/when-proxypass-and-proxypassreverse-arent-enough/

Note the path specification in the httpd.conf snippet:
Include conf.d/proxy_html.conf
ProxyPass        /backend/ http://foo.example.com:1234/
ProxyPassReverse /backend/ http://foo.example.com:1234/
ProxyHTMLURLMap http://foo.example.com:1234 /backend

<Location /backend/>
  ProxyHTMLEnable On
  ProxyPassReverse http://foo.example.com:1234/
  SetOutputFilter proxy-html
  ProxyHTMLURLMap / /backend/
  ProxyHTMLURLMap /backend /backend
</Location>

Open in new window