In varnish document, it said varnish dosen't cache content within cookies. But I find varnish cached the content in my <span id="result_box" class="short_text" lang="en"><span style="" title="">environment, so the login user chaos at all. This is my config vcl:<br>
<br>backend www {<br> .host = "<a href="http://www.sample.com">www.sample.com</a>";<br> .port = "80";<br>}<br><br>backend v {<br> .host = "<a href="http://v.sample.com">v.sample.com</a>";<br>
.port = "80";<br>}<br><br>backend u {<br> .host = "<a href="http://u.sample.com">u.sample.com</a>";<br> .port = "80";<br>}<br><br><br>backend so {<br> .host = "<a href="http://so.sample.com">so.sample.com</a>";<br>
.port = "80";<br>}<br><br>acl purge {<br> "localhost";<br> "10.0.0.0"/8;<br>}<br><br>sub vcl_recv {<br> set req.grace = 30m;<br><br> if (req.http.x-forwarded-for) {<br> set req.http.X-Forwarded-For = req.http.X-Forwarded-For ", " client.ip;<br>
} else {<br> set req.http.X-Forwarded-For = client.ip;<br> }<br><br> if (req.http.range && !req.url ~ "^/player/get\w*M3U8/.*") {<br> error 403 "Forbidden";<br> }<br>
<br> if (req.http.host ~ "^(www.)?<a href="http://sample.com">sample.com</a>$") {<br> set req.backend = www;<br> } elsif (req.http.host ~ "^<a href="http://v.sample.com">v.sample.com</a>$") {<br>
set req.backend = v;<br> } elsif (req.http.host ~ "^<a href="http://u.sample.com">u.sample.com</a>$") {<br> set req.backend = u;<br> } elsif (req.http.host ~ "^<a href="http://so.sample.com">so.sample.com</a>$") {<br>
set req.backend = so;<br> } else {<br> error 404 "Unknown virtual host";<br> }<br><br> # Allow ip from PURGE acl<br> if (req.request == "PURGE") {<br> if (!client.ip ~ purge) {<br>
error 405 "Not allowed.";<br> }<br> return (lookup);<br> }<br><br> if (req.request != "GET" && req.request != "HEAD") {<br> return (pass);<br>
}<br> <br> if (req.http.authenticate || req.http.authorization) {<br> return (pass);<br> }<br><br> if (req.http.cookie && req.http.cookie ~ "authtoken=") {<br> return (pass);<br>
}<br><br> return (lookup);<br>}<br><br>sub vcl_hit {<br> if (req.request == "PURGE") {<br> set obj.ttl = 0s;<br> error 200 "Purged";<br> }<br><br> if (!obj.cacheable) {<br>
return (pass);<br> }<br><br> return (deliver);<br>}<br><br>sub vcl_miss {<br> if (req.request == "PURGE") {<br> error 405 "Not in cache";<br> }<br> <br> return (fetch);<br>
}<br><br>sub vcl_deliver {<br> if (obj.hits > 0) {<br> set resp.http.X-Cache = "HIT on a29.squid";<br> } else {<br> set resp.http.X-Cache = "MISS from a29.squid";<br> }<br><br>
# Remove unused varnish header<br> remove resp.http.X-Varnish;<br> return (deliver);<br>}<br><br>sub vcl_fetch {<br> set beresp.grace = 30m;<br><br> return (deliver);<br>}<br><br>sub vcl_pass {<br> remove bereq.http.X-Varnish;<br>
<br> return (pass);<br>}<br><br>sub vcl_error {<br> set obj.http.Cache-Control = "no-store, no-cache, must-revalidate";<br> set obj.http.Content-Type = "text/html; charset=utf-8";<br> synthetic {""};<br>
return (deliver);<br>}<br></span></span>