Sunday, August 29, 2010

ProxyRequests and ProxyPass in Apache

Apache can do both forward proxying and reverse proxying.

forward proxying-
Acting as a tunnel to the internet. Users has to configure there application software (Eg. Internet Brower)  by adding the IP of the proxy server in order to access Internet.To activate forward proxying in Appache need to add the following configuration in httpd.conf file.
ProxyRequests On
When accessed through a proxy the ip of the user is not visible so users can do unauthorised activities by hiding himself. Because of this the administrator should secure the server and allow access only to authorised users.

Reverse proxying-
Acting as a web server to third party content. The server will grab content from
a third party server and send to the user as if the server it self is generating the content.To activate reverse proxying in Appache need to add the following configuration.
ProxyRequests Off #Not necessary however.
ProxyPass /path-to-content http://some-other-server.domain
There is however one glitch here. The browser headers will hold the original server
details plus the relative links in the provided content will link directly to the
original site. To avoid this need to add another configuration ProxyPassReverse
as below.
ProxyPass /path-to-content http://some-other-server.domain
ProxyPassReverse /path-to-content http://some-other-server.domain 

Serving sub directory content by the server it self-
Any sub directory of a directory path can be configured to serve contents of itself rather than serving content from the same third party server.To do this use the exclamation mark in front of the directory which needs to be blocked and serve own content.
ProxyPass /path-to-content/sub-directory !
ProxyPass /path-to-content http://some-other-server.domain
ProxyPassReverse /path-to-content http://some-other-server.domain 
 
References:
http://helpful.knobs-dials.com/index.php/Apache_URL_rewriting 
 


No comments:

Post a Comment

Subscribe