Link to home
Start Free TrialLog in
Avatar of beer9
beer9Flag 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

Avatar of LajuanTaylor
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."
Avatar of 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

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>
ASKER CERTIFIED SOLUTION
Avatar of LajuanTaylor
LajuanTaylor

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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