eZ Community » Forums » eZ Publish 5 Platform » ezp5 with vanish - not caching curl...

ezp5 with vanish - not caching curl request

ezp5 with vanish - not caching curl request

Tuesday 04 February 2014 10:53:43 am - 4 replies


maybe it's just my installation. But would be great to get your feedback if your installation is also affected:

I'm running ezp5.2 with varnish. In my browser, I can see that the pages get cached (The Response Header "Age" has a non-zero value).

Any requests with curl ( curl -I http://my.site.com/ ) are always showing "Age: 0". Basically non-cached versions:

 HTTP/1.1 200 OK 
<span style="font-size: 1.1em;">Server: Apache/2.2.22 (Ubuntu)
</span><span style="font-size: 1.1em;">X-Powered-By: PHP/5.3.10-1ubuntu3.9
</span><span style="font-size: 1.1em;">Set-Cookie: eZSESSID=b08a2f94ic46q88nh3ji3m3257; path=/
</span><span style="font-size: 1.1em;">Cache-Control: public
</span><span style="font-size: 1.1em;">X-Location-Id: 2
</span><span style="font-size: 1.1em;">Vary: Accept-Encoding
</span><span style="font-size: 1.1em;">Content-Type: text/html; charset=UTF-8
</span><span style="font-size: 1.1em;">Date: Tue, 04 Feb 2014 09:35:42 GMT
</span><span style="font-size: 1.1em;">X-Varnish: 1964721707
</span><span style="font-size: 1.1em;">Age: 0
</span><span style="font-size: 1.1em;">Via: 1.1 varnish
</span><span style="font-size: 1.1em;">Connection: keep-alive</span>

Tuesday 04 February 2014 2:02:24 pm

It might be the presence of the Set-Cookie header.


Depending on what you are trying to do with curl, you could unset the cookie on responses to requests from curl.  Another option would be to use the curl cookie options.


Tuesday 04 February 2014 3:16:05 pm

Hi Betsy,

you're right, most likely the setCookie forces varnish not to cache the request:

# Don't cache response with Set-Cookie
    if ( beresp.http.Set-Cookie ) {
        set beresp.ttl = 0s;
        return (hit_for_pass);

But it's strange -- accessing the same URL is getting cached with a browser and is not getting cached with curl. Also, I'm worried that all requests from web crawlers (similar use-case to curl requests) are by-passing varnish in ezp5.2. For some sites, web crawlers make a big portion of the total traffic.

Do you have a ezp5.2 install and do you get the same results?

I'm using the varnish.vcl from here: https://confluence.ez.no/display/EZP/Using+Varnish




Wednesday 05 February 2014 4:26:37 pm

Hi Philipp,

I have eZ 5.3.0alpha1 and installed Varnish.  Unfortunately, I have Varnish 2.1 instead of 3.0 and I am all out of time.  It may be in the ez_user_hash code, perhaps if no cookie is sent, one could be assigned to deliver cached pages from a single source, rather than a user specific one.

I'm sorry I don't have a better answer.


Wednesday 05 February 2014 5:56:23 pm

Thanks Betsy, if I have some extra time, I'll check where exactly the problem is coming from. I'm just surprised that I'm the only person having that issue.


You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from