Question on: How To Set Up A Caching Reverse Proxy With Squid 2.6 On Debian Etch

Discussion in 'HOWTO-Related Questions' started by tomdkat, Jan 23, 2009.

  1. tomdkat

    tomdkat New Member

    First, thanks for posting the great tutorial! :)

    http://www.howtoforge.com/how-to-set-up-a-caching-reverse-proxy-with-squid-2.6-on-debian-etch-p2

    We're trying this out now since we want to cache static pages generated by PHP. I don't know if this changes the classification of the page from "static" to "dynamic".

    Anywho, we're interested in caching pages generated by PHP. We've got our PHP-based web app sending the correct Cache-control header to Squid (we're using Squid 3.0-STABLE12) and we're NOT sending any Expires or related headers. Using the Live HTTP Headers Firefox extension, I can see the response from Squid and it's generating a TCP_MISS each time I load the page:

    Code:
    HTTP/1.x 200 OK
    
    [b][color=red]Date: Fri, 23 Jan 2009 17:39:39 GMT
    [/color][/b]
    Server: Apache/2.2.3 (Red Hat)
    
    X-Powered-By: PHP/5.2.8
    
    Cache-Control: must-revalidate, max-age=0, s-maxage=10800
    
    Vary: Accept-Encoding
    
    Content-Encoding: gzip
    
    Content-Length: 11237
    
    Content-Type: text/html; charset=ISO-8859-1
    
    X-Cache: MISS from www.mysite.com
    
    Via: 1.0 www.mysite.com (squid/3.0.STABLE12)
    
    Connection: keep-alive
    
    
    Code:
    HTTP/1.x 200 OK
    
    [b][color=red]Date: Fri, 23 Jan 2009 17:41:26 GMT
    [/color][/b]
    Server: Apache/2.2.3 (Red Hat)
    
    X-Powered-By: PHP/5.2.8
    
    Cache-Control: must-revalidate, max-age=0, s-maxage=10800
    
    Vary: Accept-Encoding
    
    Content-Encoding: gzip
    
    Content-Length: 11233
    
    Content-Type: text/html; charset=ISO-8859-1
    
    X-Cache: MISS from www.mysite.com
    
    Via: 1.0 www.mysite.com (squid/3.0.STABLE12)
    
    Connection: keep-alive
    
    
    Is it possible the tutorial doesn't apply to Squid 3? Any ideas?

    Thanks!

    Peace...
     
  2. falko

    falko Super Moderator Howtoforge Staff

    Yes, that's possible. Unfortunately lots of things change between the Squid versions. :( Try 2.6.
     
  3. tomdkat

    tomdkat New Member

    Ok, I got my problem figured out. :)

    The problem was with my use of basic authentication being used to protect the site I'm currently testing with Squid acting as a HTTP accelerator. :)

    Once I added a "public" Cache-Control header to the mix, everything started working just fine AND with Squid 3.0-STABLE12. :)

    The only thing is with Squid 3, you will get these warning messages in the cache.log file:
    Code:
    2009/01/24 17:46:54| ACL::checklistMatches WARNING: 'cookie_logged_in_set' ACL is used but there is no HTTP reply -- not matching.
    2009/01/24 17:46:54| ACL::checklistMatches WARNING: 'cookie_logged_in_out' ACL is used but there is no HTTP reply -- not matching.
    
    This is due to the use of the rep_header ACL acltype being used. Apparently, at the time that ACL is processed, the request to the origin server hasn't been made yet so there won't be any HTTP reply to process:

    http://www.squid-cache.org/mail-archive/squid-users/200901/0501.html

    In any event, things seem to be working just fine now!

    Thanks!

    Peace...
     

Share This Page