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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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>
1
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.