Re: [squid-users] Poor mans static CDN

From: Chris Robertson <crobertson_at_gci.net>
Date: Mon, 25 Jan 2010 15:24:16 -0900

beachie_at_tiscali.co.uk wrote:
> Hi,
>
> Is there any way to configure the following scenario? I run a
> wordpress blog and wish to offload the static content to squid by re-
> writing the hostnames in the templates. We have plenty of bandwidth on
> tap but the apache resources on our VM appear to be pointlessly tied up
> when busy serving the larger static content (images, crazy js/css) to
> slow clients.
>
> So, If the blog runs on blog.tld and is also the origin server I'd
> like to serve the static content from cache.blog.tld and have it pull
> the content from the origin blog.tld site.
>

If I understand correctly, you want clients to request static content
from cache.blog.tld, but you want cache.blog.tld to request non-cached
static content from blog.tld. A url_rewrite_program (and/or some
counseling) is in order:

http://www.squid-cache.org/Doc/config/url_rewrite_program/

> This is what I have setup so far:
>
> http_port external-IP2:80 vhost defaultsite=cache.blog.tld vhost
> cache_peer blog.tld parent 80 0 no-query originserver login=PASS
>

I'd also suggest changing your "defaultsite" to blog.tld, as that is
what Squid will send as the Host header if one is lacking in the
original request.

> What appears to be happening is that the Host: header in the request
> to the origin is "cache.blog.tld" rather than blog.tld.
>
> Since I may have to do this for a lot of sites I don't really want to
> fix this with apache's serveralias workaround as I intend to use a
> wordpress filter plugin to re-write the static objects to use the cache
> on the busy sites.

A simple redirect program that strips a leading "cache." from the
requested domain name will give you the flexibility to do this.

>
>
> TIA!
> B.
>

Chris
Received on Tue Jan 26 2010 - 00:24:39 MST

This archive was generated by hypermail 2.2.0 : Tue Jan 26 2010 - 12:00:04 MST