mod_proxy

mod_proxy is now the preferred solution for both forward and reverse proxy, as well as load balancing and tomcat proxying (back up this statement !)

There are two types of Proxy; Forward and Reverse;

1.1 Forward Proxy

This is the traditional type of proxy we normally think about where the client, typicaly a web browser, sits behind the server and asks it for web content. The server fetches it for you and delivers it back, caching and maintaining sessions as needed.

1.1 Reverse Proxy

The reverse proxy is used in server environments. The proxy server sits in front of other client servers. Requests for content are made of the proxy server and it resolves them behind the scenes, port forwarding, load balancing and etc as needed.

1.1 Reverse Proxy and Apache

On sysconfig manged systems (such as SuSE), install mod_proxy using yast or whatever tool is appropriate for your system, and edit the file
{quote}/etc/sysconfig/apache2{quote}
You need to create a config file for the module and include it on the appropriate line. This line is marked:
{quote}APACHE_CONF_INCLUDE_FILES="/etc/apache2/mod_proxy.conf"{quote}
It is important to __secure__ the proxy server, as an open proxy can be used to make attacks against other hosts. Include this section to ensure it cannot be used as such.
{code:none}
# see http://httpd.apache.org/docs-2.0/mod/mod_proxy.html
#
<IfModule mod_proxy.c>

     ProxyRequests Off

</IfModule>
{code}

1.1 Using a proxy with a Virtual Host

You can add proxy directives to any section. To make them specific to a single virtual host, and them to the appropriate /etc/apache2/vhosts.d file as follows.

{code:none}
ProxyRequests Off

<Proxy *>
    Order deny,allow
    Allow from all
</Proxy>

ProxyPass /test http://outreach.ev.net/test
ProxyPassReverse /test http://outreach.ev.net/test
{code}

It is important to realize that the directory name must match on both sides (eg 'test') or the proxy will not work as you expect.







Comments