Re: [squid-users] Squid behind Apache on same server to cache images on Amazon S3

From: Amos Jeffries <squid3@dont-contact.us>
Date: Tue, 21 Aug 2007 12:05:55 +1200 (NZST)

>
> We want to cache images that are stored on Amazon S3. In the
> preferred approach, Squid runs behind Apache (on the same server),
> where a rewriterule assures that only image requests that are stored
> on S3 are handled by Squid. All other HTTP requests should go
> directly to Apache.

This configuration effectively removes any benefits gained from having a
Squid/Apache pairing. Apache itself has an efficient cache.
The improvements Squid adds to the process is mainly in taking connection
handling off of Apaches' shoulders.

>
> Is this possible?

Yes, but enourmously cumbersome. Consider where squid will get the images
to begin with. There are ramp-up and renewal periods where squid needs to
load the objects images from a source server.

 You will need to configure like so:
Apache(gateway) -> squid -> Apache(Images)

or in VERY carefully configured and maintained loop like:
 Apache --> Squid -+
    +--------------+

if ApacheG and ApacheI are the same server, things get complex rather
quickly. You need to be extremely careful not to loop requests coming into
apache from squid back to squid again or clients will see errors pages.

MUCH simpler, efficient, and scalable to simply code your site to handle
X-Forwarded-For and Via: headers at the IP-dependant points, (which it
will get from some clients anyway).
Then to place as many squid as you need as the main gateways, with 'cache
deny' on anything but images, and apache as the sole parent source.

There is a fourth option of using a seperate external-facing port on squid
and bypassing the Apache re-write needs by coding all image URL to use
that port.

> And how does this setup look like in terms of
> squid.config, rewriterule, etc?

Depends on your choice of the above setups.

>
> Here's a sample image stored on S3 (using a CNAME that points to a
> bucket):
>
> http://static.assetdeli.com/aston1.png
>
> cheers, Ivo
>

Amos
Received on Mon Aug 20 2007 - 18:05:59 MDT

This archive was generated by hypermail pre-2.1.9 : Sat Sep 01 2007 - 12:00:03 MDT