0
votes

I am using ESI for not caching a fragment of page. I have written the following configuration in vcl file for not caching my fragment:

sub vcl_backend_response{
   set beresp.do_esi = true;
   if (bereq.url ~ "/fragment") {
        set beresp.uncacheable = true;
        return (deliver);
    }   
}

The first time when varnish brings whole page from backend, it sends separate request for '/fragment' and puts it proper place of page. But on refreshing the page, varnish only reuests for the main page and it finds it in cache. Then it does not look up for esi fragment in this page and does not send request for it. Instead it is stored in the main page itself while caching main page and brings it from there while doing lookup. I want to know how to bring the fragment from backend, everytime request for main page is made, while serving rest of content of main page from cache.

1

1 Answers

0
votes

Putting unset resp.http.Etag; inside vcl_deliver subroutine worked for me.