Proxy/ReverseProxy and Apache2

I recently configured Apache2 to be a ReverseProxy/Proxy and thought I would share my experiences while it was still fresh. Having never configured any kind of proxy, I found this webpage very informative. The scenario I would like to use for my example is that I have three internal web servers called

SITELOCAL IPREMOTE IPPORT
www.reallycoolsite.com192.168.1.10210.15.22.180
www.justcoolsite.com192.168.1.10210.15.22.280
www.reallylamesite.com192.168.1.4410.15.22.380

Alright…pretty straight forward right? If you are in a situation that I was when I started, you haven’t done much more than install apache from source and added a few modules here and there occasionally. The way I solved the problem was to create name-based virtual host for each of the servers. our example would look like

#you can listen on specific ports for requests if you like
#(ex->Listen 192.168.1.102:80)
#I use the below statement to listen on 80 for all requests
Listen *:80
#Because we have multiple names mapped to same ip
NameVirtualHost 192.168.1.102:80

<VirtualHost 192.168.1.102:80 >
    ServerName www.reallycoolsite.com
    ProxyRequests Off
    ProxyPass / http://10.15.22.1/
    ProxyReverse / http://www.reallycoolsite.com/
    ProxyPreserveHost On
    ErrorLog reallycoolsite_error_log
    CustomLog reallycoolsite_access_logs
</VirtualHost >

<VirtualHost 192.168.1.102:80 >
    ServerName www.justcoolsite.com
    ProxyRequests Off
    ProxyPass / http://10.15.22.2/
    ProxyReverse / http://www.justcoolsite.com/
    ProxyPreserveHost On
    ErrorLog justcoolsite_error_log
    CustomLog justcoolsite_access_logs
</VirtualHost >

<VirtualHost 192.168.1.44:80 >
    ServerName www.reallylamesite.com
    ProxyRequests Off
    ProxyPass / http://10.15.22.3/
    ProxyReverse / http://www.reallylamesite.com/
    ProxyPreserveHost On
    ErrorLog reallylamesite_error_log
    CustomLog reallylamesite_access_logs
</VirtualHost >

If you receive errors during the communication of your proxy and your server, it may be a good idea to investigate if you have an http protocol error discussed at the bottom of this page

The following two lines are pulled from the reference and fixed a problem I had with one of my IIS servers using SSL(for more info about the issue, go here)

    SetEnv force-proxy-request-1.0 1
    SetEnv proxy-nokeepalive 1

My apache configuration file(httpd.conf) was the file I used to edit my settings.. Your file may be different depending on how new your apache version is. I found that some implementations called the configuration file apache.conf…. I hope this blog entry is helpful you, Happy Configuring!