Apache as Forward Proxy

An Apache forward proxy is an intermediate server that is  between the client and origin server.To receive content from  origin server,  client sends a request to proxy naming  origin server as the target and the proxy then requests  content from the origin server and returns it to the client. Client host must be specially configured to use the forward proxy to use other sites.

Forward proxy is used to give access to internal clients that are restricted by a firewall.This can also be use caching (mod to be used mod_cache) to cut bandwith usage.Never enable proxy with ProxyRequests until you have harden security. Open proxy servers are dangerous in network and as well as internet.Antonymous user can use your internet without your consense.

Steps to convert apache as forward proxy

1. Install mod-proxy-html
# apt-get install libapache2-mod-proxy-html
2.Enable proxy proxy_html and proxy_http module for http request
# a2enmod proxy
# a2enmod proxy_html
# a2enmod proxy_http

3. Enable Connect Module for https requests
# a2enmod proxy_connect

4. cp /etc/apache2/sites-available/default /etc/apache2/sites-available/proxy

5. put in a desired port, and append at the end within <VirtualHost> directive
#for HTTP Requests
ProxyRequests On
ProxyVia On

#For HTTPS Request
SSLProxyEngine On
AllowCONNECT 443

Order deny,allow
Deny from all
Allow from [hostname or IP]

hostname or IP is the one you need to allow proxy to be accessed from

6. Enable Proxy site
# a2ensite proxy

6. Append the following at the bottom of ports.conf:
Listen [your port]
The port that you have desired to use as forward Proxy

7. restart apache
service apache2 restart

That makes apache as a forward proxy and as alternate to squid in windows if the squid build for windows doesnot support in your system.


Leave a Reply

Your email address will not be published. Required fields are marked *