<div dir="ltr">Hi,<div><br></div><div>That's really going to be hard to debug without some logs. Anyway, your vcl doeesn't unset set-cookie headers, so you can expect you cached objects to wreck some havoc since they will be reused for multiple clients.</div><div><br></div><div>Regards,</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>-- <br></div>Guillaume Quintard<br></div></div></div>
<br><div class="gmail_quote">On Fri, Apr 27, 2018 at 4:57 PM, Pinakee BIswas <span dir="ltr"><<a href="mailto:pinakee@waltzz.com" target="_blank">pinakee@waltzz.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
We have been using Varnish for caching our web pages. We have an ecommerce site. Things have been working fine till today but suddenly things have started breaking down and I am not sure why. Following is the issue:<br>
<br>
We use session cookie to store user sessions. The session cookie is getting changed as Cached responses from varnish is having set-cookie header which is messing up the session cookie. We are using varnish 4.8. Following is a snippet of the VCL:<br>
<br>
<br>
sub vcl_recv {<br>
    # Happens before we check if we have this in cache already.<br>
    #<br>
    # Typically you clean up the request here, removing cookies you don't need,<br>
    # rewriting the request, etc.<br>
    set req.backend_hint = uwsgi;<br>
<br>
    #if (req.http.cookie ~ "jivaana_country=") {<br>
        # Set the country header<br>
#       set req.http.X-CLIENT-COUNTRY = regsub(req.http.cookie, ".*jivaana_country=([^;]+);.*"<wbr>, "\1");<br>
#    }<br>
<br>
   std.log("ga:" + ga.extract(req.url, mode = keep));<br>
   set req.url = ga.apply(req.url); #  remove Google Analytics parameters<br>
<br>
   if (req.method == "GET") {<br>
        if ((req.url !~ "^/accounts/userheader") &&<br>
            (req.url !~ "^/accounts/new-userheader") &&<br>
            (req.url !~ "^/product/recently-viewed") &&<br>
            (req.url !~ "^/product/recommended-product<wbr>s") &&<br>
            (req.url !~ "^/product/addtobasket")) {<br>
                unset req.http.cookie; # strip the cookies - we don't need them<br>
        }<br>
    }<br>
<br>
    call devicedetect;<br>
}<br>
<br>
sub vcl_backend_response {<br>
    # Happens after we have read the response headers from the backend.<br>
    #<br>
    # Here you clean the response headers, removing silly Set-Cookie headers<br>
    # and other mistakes your backend does.<br>
    if (bereq.method == "GET") {<br>
        set beresp.do_esi = true;<br>
        if ((bereq.url !~ "^/accounts/userheader") &&<br>
            (bereq.url !~ "^/accounts/new-userheader") &&<br>
            (bereq.url !~ "^/product/recently-viewed") &&<br>
            (bereq.url !~ "^/product/recommended-product<wbr>s") &&<br>
            (bereq.url !~ "^/product/addtobasket")) {<br>
                #unset beresp.http.Set-Cookie;<br>
                set beresp.uncacheable = false;<br>
                #std.log("Caching the url : **********************" + bereq.url);<br>
   }<br>
}<br>
<br>
sub vcl_deliver {<br>
    # Happens when we have all the pieces we need, and are about to send the<br>
    # response to the client.<br>
    #<br>
    # You can do accounting or modifying the final object here.<br>
}<br>
<br>
sub vcl_hash {<br>
}<br>
<br>
Would really appreciate any support as this is messing up our user sessions.<br>
<br>
Thanks,<br>
<br>
Pinakee<br>
<br>
______________________________<wbr>_________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org" target="_blank">varnish-misc@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" rel="noreferrer" target="_blank">https://www.varnish-cache.org/<wbr>lists/mailman/listinfo/varnish<wbr>-misc</a><br>
</blockquote></div><br></div>