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

beer9Asked:
Who is Participating?
 
LajuanTaylorCommented:
ProxyPassReverse
The directive  ProxyPassReverse lets Apache adjust the URL in the Location header on HTTP redirect responses.

If you need to use APACHE as a reverse proxy this is important so that the reverse proxy is not bypassed because of HTTP redirects on the back-end servers which stay behind the reverse proxy.  For example,

Suppose your local server has address  http:/i-mycompany.com/; then

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

will cause the local request for the <http:/i-mycompany.com/mirror/apps/dashboard> to be internally converted into a proxy request to <http://apps.i-mycompany.com/dashboard>
0
 
LajuanTaylorCommented:
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."
0
 
beer9Author Commented:
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

0
 
LajuanTaylorCommented:
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>
0
 
LajuanTaylorCommented:
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

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.