Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy do I have this feeling that Varnish is caching the pages only visited by same user
    primarykey
    data
    text
    <p>After started Varnish, I visited the website once. After populating all pages, revisiting all the pages become so fast. </p> <p>But when I switch to another computer and visit the site, it seems I have to start again this cache populating process. </p> <p>So it seems that Varnish is not serving cached pages cached by the other user</p> <p>I hope that I have addressed my question clearly. </p> <p>Does anyone knows what happened. </p> <p>Here is the vcl file</p> <pre><code>backend Tserver { .host = "127.0.0.1"; .port = "8080"; } acl purge { "localhost"; "127.0.0.1"; "192.168.3.0"/24; } sub vcl_recv { if (req.request == "PURGE") { if (!client.ip ~ purge) { error 405 "Not allowed."; } return(lookup); } #without this, the whole logged in status is messed up remove req.http.X-Forwarded-For; set req.http.X-Forwarded-For = client.ip; // Remove has_js and Google Analytics cookies set req.http.Cookie = regsuball(req.http.Cookie, "(^|;\s*)(_[_a-z]+|has_js)=[^;]*",""); #if(req.http.Authorization || req.http.Cookie) { # /* Not cachable by default */ # return (pass); #} // remove a ";" prefix, if present #set req.http.Cookie = regsub(req.http.Cookie, "^;\s*", ""); // remove empty cookies. #if (req.http.Cookie ~ "^\s*$") { # unset req.http.Cookie; #} // Skip the Vanish cache for install, update, and cron if (req.url ~ "install\.php|update\.php|cron\.php") { return (pass); } # Normalize Accept-Encoding to get better cache coherency if (req.http.Accept-Encoding) { # No point in compressing media that is already compressed if (req.url ~ "\.(jpg|png|gif|gz|tgz|bz2|tbz|mp3|ogg)$") { remove req.http.Accept-Encoding; # MSIE 6 JS bug workaround } elsif(req.http.User-Agent ~ "MSIE 6") { unset req.http.Accept-Encoding; } elsif (req.http.Accept-Encoding ~ "gzip") { set req.http.Accept-Encoding = "gzip"; } elsif (req.http.Accept-Encoding ~ "deflate") { set req.http.Accept-Encoding = "deflate"; } else { # unkown algorithm remove req.http.Accept-Encoding; } } #if (req.url ~ "^/classifieds") { # return(pipe); #} #if (req.url ~ "^/logout") { # return(pipe); #} #if (req.url ~ "^/admin") { # return(pipe); #} # Remove the incoming Cookie header from anonymous requests # This is from Drupal 7 book, not sure if this works here #if (req.http.Cookie !~ "(^|;\s*)SESS") { # unset req.http.Cookie; #} /* if (req.http.Cookie) { set req.http.Cookie = ";" req.http.Cookie; set req.http.Cookie = regsuball(req.http.Cookie, "; +", ";"); set req.http.Cookie = regsuball(req.http.Cookie, ";(LOGGED_IN|VARNISH)=", "; \1="); set req.http.Cookie = regsuball(req.http.Cookie, ";[^ ][^;]*", ""); set req.http.Cookie = regsuball(req.http.Cookie, "^[; ]+|[; ]+$", ""); if (req.http.Cookie == "") { remove req.http.Cookie; } } */ # ... other vcl_recv rules here ... # Don't serve cached content to logged-in users # Don't cache Drupal logged-in user sessions # LOGGED_IN is the cookie that earlier version of Pressflow sets # VARNISH is the cookie which the varnish.module sets if (req.http.Cookie ~ "(VARNISH|DRUPAL_UID|LOGGED_IN)") { return (pipe); } // Let's have a little grace // When backend cannot generate refreshed content // this time will allow expired content to stay longer in grace set req.grace = 0s; if (req.http.host ~ "^www.test1.com") { set req.backend = Tserver; if (req.request != "GET" &amp;&amp; req.request != "HEAD") { return(pipe); } else { return(lookup); } }elsif (req.http.host ~ "^www.test2.com") { set req.backend = Tserver; if (req.request != "GET" &amp;&amp; req.request != "HEAD") { return(pipe); } else { return(lookup); } } else { error 404 "T Cache Server IS Out of Order"; return(lookup); } # Drupal js/css doesn't need cookies, cache them if (req.url ~ "^/modules/.*\.(js|css)\?") { unset req.http.Cookie; } ## Pass cron jobs and server-status if (req.url ~ "cron.php") { return (pass); } if (req.url ~ ".*/server-status$") { return (pass); } } sub vcl_hash { if (req.http.Cookie) { set req.hash += req.http.Cookie; } } sub vcl_hit { if (req.http.Cookie ~ "LOGGED_IN") { set obj.ttl = 0s; return (pass); } if (req.request == "PURGE") { set obj.ttl = 0s; error 200 "Purged."; } } sub vcl_miss { if (req.request == "PURGE") { error 404 "Not in cache."; } } sub vcl_fetch { if (req.url ~ "\.(png|gif|jpg|swf|css|js)$") { unset beresp.http.set-cookie; } #if (beresp.http.Pragma ~ "nocache") { # return(pass); #} if (req.request == "GET" &amp;&amp; req.url ~ "\.(txt|js)$") { set beresp.ttl = 3600s; } elseif (req.http.Cookie ~ "LOGGED_IN") { set beresp.ttl = 0s; } else { // cache time is 30 days then in varnish set beresp.ttl = 30d; } } sub vcl_error { set obj.http.Content-Type = "text/html; charset=utf-8"; set obj.http.Retry-After = "5"; synthetic {"&lt;?xml version="1.0" encoding="utf-8"?&gt;&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;&lt;html&gt;&lt;head&gt;&lt;title&gt;"} obj.status " " obj.response {"&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;h1&gt;Error "} obj.status " " obj.response {"&lt;/h1&gt;&lt;p&gt;"} obj.response {"&lt;/p&gt;&lt;h3&gt;Guru Meditation:&lt;/h3&gt;&lt;p&gt;XID: "} req.xid {"&lt;/p&gt;&lt;hr&gt;&lt;p&gt;Varnish cache server&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;"}; return (deliver); } sub vcl_pipe { # http://www.varnish-cache.org/ticket/451 # This forces every pipe request to be the first one. set bereq.http.connection = "close"; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload