<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">hello,<div>This confusing behavior was due to a some of different factor a bug in django cache middleware for i18n pages, the same pages in french, german, english, .... and my relative inexperince with varnish. I think that now I have this issue solved witht the following configuration: <a href="http://dpaste.com/165182/" target="_blank">http://dpaste.com/165182/</a></div>
<div><br></div><div>The interesting parts are in vcl_recv : </div><div><span style="font-family:'Bitstream Vera Sans Mono', 'Courier New', Monaco, monospace;font-size:14px;white-space:pre"> # This is the only important part of the cookie because</span></div>
<span style="font-family:Georgia;font-size:medium"><pre style="font-family:'Bitstream Vera Sans Mono', 'Courier New', Monaco, monospace;font-size:14px"> # an annonymous user could get a page that was generated and
# cached for another user.
if (req.http.Cookie ~ "django_language=") {
set req.http.X-Varnish-Language =
regsub(req.http.Cookie, "django_language=([a-z]{2})", "\1"); </pre></span><div><span style="font-family:'Bitstream Vera Sans Mono', 'Courier New', Monaco, monospace;font-size:14px;white-space:pre"> }</span> </div>
<div> </div><div>in vcl_hach where I add the language to the hash :</div><div class="im"><div><span style="font-family:Georgia;font-size:medium"><pre style="font-family:'Bitstream Vera Sans Mono', 'Courier New', Monaco, monospace;font-size:14px">
sub vcl_hash {
set req.hash += req.url;
if (req.http.host) {
set req.hash += req.http.host;
} else {
set req.hash += server.ip;
}
set req.hash += req.http.X-Varnish-Language;
return (hash);
}</pre></span></div></div><div>and in vcl_fetch where I have commented out the block that make varnish "pass" if there is a cookie :</div><div><span style="font-family:Georgia;font-size:medium"><pre style="font-family:'Bitstream Vera Sans Mono', 'Courier New', Monaco, monospace;font-size:14px">
sub vcl_fetch {
if (obj.http.Pragma ~ "no-cache" || obj.http.Cache-Control ~ "(no-cache|no-store|private)") {
# varnish by default ignores Pragma and Cache-Control headers. It
# only looks at the "max-age=" value in the Cache-Control header to
# determine the TTL. So we need this rule so that the cache respects
# the wishes of the backend application.
pass;
}
if (!obj.cacheable) {
return (pass);
}
# don't allow caching pages that are protected by basic authentication
# unless when they explicitly set the cache-control to public.
if (req.http.Authorization && !obj.http.Cache-Control ~ "public") {
pass;
}
# Varnish by default does not serve from cache if there is a cookie
# if (obj.http.Set-Cookie) {
# return (pass);
# }
set obj.prefetch = -30s;
return (deliver);
}</pre></span></div><div>thank you</div><div>Regards,</div><div>--yml</div><div><div></div><div class="h5"><div><br></div>
</div></div></blockquote></div><br>