[squid-users] Using squid as a Web cache for many Apache/Jboss servers

From: <DGeorgie@dont-contact.us>
Date: Wed, 24 Aug 2005 14:42:38 -0400

Hi,

I am trying to set up Squid server as a common cache server for many
Apache servers. Each Apache Web server is running as a front end for a
J2EE application hosted on JBoss/Tomcat server.

Depending on a URL pattern Apache is sending requests to either Squid or
JBoss/Tomcat. If Squid cannot find requested resource in the cache it
contacts the J2EE application on JBoss/Tomcat on port 8080 to load the
resource (a BLOB, image, Flash file etc) from the database. In situations
like this it is crucial that Squid contacts the JBoss server on the same
host from which Apache sent the request for caching to Squid. Otherwise
the user session in the J2EE application is invalidated.

The problem is that Squid always tries to contact JBoss/Tomcat on the
local host instead of the host that sent the caching request.

Basically I am trying to tell squid to use the value of Host header to use

when generating a request for the missing resources. So far I have not
succeeded.

Load balancer is forwarding user requests to Apache servers in round robin

fashion. The application is accessed with the following URL :
http://app_name.somedomain.com
Apache/JBoss/Tomcat are on host1
Squid is on host 2.

These are the settings in Apache httpsd.conf file that forward the caching

requests to Squid on host1
================================================================
ProxyPass /cache/pattern http://host2.somedomain.com:81/cache/pattern
ProxyPassReverse /cache/pattern
http://host2.somedomain.com:81/cache/pattern

<ProxyMatch "/cache/pattern">
        RequestHeader set Host host1.somedomain.com
</ProxyMatch>

These are Squid settings on host , say, host2
=========================================
http_port 81
http_port 3128

httpd_accel_host app_name.somedomain.com
httpd_accel_port 8080
httpd_accel_single_host off
httpd_accel_uses_host_header on
httpd_accel_with_proxy on

We are using

Squid 2.5 stable
Apache 2.0.x
JBoss3.2.7/Tomcat 5.0
RedHat EL 3.0

many thanks,

Dimitar
Received on Wed Aug 24 2005 - 12:42:47 MDT

This archive was generated by hypermail pre-2.1.9 : Thu Sep 01 2005 - 12:00:02 MDT