Apache can be used as Forward Proxy or Reverse Proxy, how to determine whether Apache is using as Forward Proxy or Reverse Proxy? I think it is configed in httpd.conf
file, but I don't know which configuration field decide this.
ProxyPass and ProxyPassReverse are the directives that need to be configured to set up Apache as a reverse proxy.
In simple terms 'ProxyPass' performs unidirectional address space conversion from external to internal as in :
ProxyPass /app1/ http://internal1.example.com/
ProxyPass /app2/ http://internal2.example.com/
so http://www.example.com/app1/some-path
maps to http://internal1.example.com/some-path
as required.
while ProxyPassReverse performs the inverse translation from the app/web -server response to the externally address space as in :
ProxyPassReverse /app1/ http://internal1.example.com/
ProxyPassReverse /app2/ http://internal2.example.com/
this enables self-references/references to other internal servers to not pass through as-is but to be converted to external address spaces, in case of re-directs for example:
HTTP/1.1 302 Found
Location: http://internal.example.com/foo/
//ProxyPass lets this through to user browser as-is!
with Reverse Proxy this gets returned to the user's browser as
HTTP/1.1 302 Found
Location: http://www.example.com/foo/
using a ProxyPassReverse directive.