Re: [squid-users] Poor mans static CDN
Chris Robertson wrote: beac...@tiscali.co.uk wrote: Original Message From: crobert...@gci.net Date: 26/01/2010 0:24 To: Subj: Re: [squid-users] Poor mans static CDN A simple redirect program that strips a leading "cache." from the requested domain name will give you the flexibility to do this. Thanks for responding Chris. So now I have the following config: http_port external-iip2:80 vhost defaultsite=blog.tld cache_peer blog.tld parent 80 0 no-query originserver login=PASS url_rewrite_program /etc/squid/r.pl r.pl does a simple substitution s/cache.blog.tld/blog.tld/i and appears to be working clientRedirectDone: 'http://cache.blog.tld/?9834733' result=http: //blog.tld/?9834733 << [check] But the debug shows the request being build with the cache hostname. httpBuildRequestHeader: Host: cache.blog.tld httpBuildRequestHeader: User-Agent: ... ... Packet capture: GET /?9834733 HTTP/1.0 Host: cache.blog.tld Any more ideas? http://www.squid-cache.org/Doc/config/url_rewrite_host_header/ Should be "on" by default, so I didn't mention it originally. I believe the whole rewriter part is the same as setting the forcedomain=blog.tld option on the cache_peer line. If that works it will be a lot more efficient than a redirector ever can. Amos -- Please be using Current Stable Squid 2.7.STABLE7 or 3.0.STABLE21 Current Beta Squid 3.1.0.15
Re: [squid-users] Poor mans static CDN
beac...@tiscali.co.uk wrote: Original Message From: crobert...@gci.net Date: 26/01/2010 0:24 To: Subj: Re: [squid-users] Poor mans static CDN A simple redirect program that strips a leading "cache." from the requested domain name will give you the flexibility to do this. Thanks for responding Chris. So now I have the following config: http_port external-iip2:80 vhost defaultsite=blog.tld cache_peer blog.tld parent 80 0 no-query originserver login=PASS url_rewrite_program /etc/squid/r.pl r.pl does a simple substitution s/cache.blog.tld/blog.tld/i and appears to be working clientRedirectDone: 'http://cache.blog.tld/?9834733' result=http: //blog.tld/?9834733 << [check] But the debug shows the request being build with the cache hostname. httpBuildRequestHeader: Host: cache.blog.tld httpBuildRequestHeader: User-Agent: ... ... Packet capture: GET /?9834733 HTTP/1.0 Host: cache.blog.tld Any more ideas? http://www.squid-cache.org/Doc/config/url_rewrite_host_header/ Should be "on" by default, so I didn't mention it originally. B. Chris
Re: [squid-users] Poor mans static CDN
>Original Message >From: crobert...@gci.net >Date: 26/01/2010 0:24 >To: >Subj: Re: [squid-users] Poor mans static CDN >A simple redirect program that strips a leading "cache." from the >requested domain name will give you the flexibility to do this. Thanks for responding Chris. So now I have the following config: http_port external-iip2:80 vhost defaultsite=blog.tld cache_peer blog.tld parent 80 0 no-query originserver login=PASS url_rewrite_program /etc/squid/r.pl r.pl does a simple substitution s/cache.blog.tld/blog.tld/i and appears to be working clientRedirectDone: 'http://cache.blog.tld/?9834733' result=http: //blog.tld/?9834733 << [check] But the debug shows the request being build with the cache hostname. httpBuildRequestHeader: Host: cache.blog.tld httpBuildRequestHeader: User-Agent: ... ... Packet capture: GET /?9834733 HTTP/1.0 Host: cache.blog.tld Any more ideas? B.
Re: [squid-users] Poor mans static CDN
beac...@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