1

My expressjs app is running in appfog. and the I put a simple date stamp to check the time in the route and the header for cache-control and expires is set for 300 seconds. neither the chrome nor varnish seems to respect it as it bringing new date stamp everytime I request.

Here is the headers

Request Method:GET
Status Code:200 OK
Request Headersview source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Cache-Control:no-cache
Connection:keep-alive
Cookie:__utma=215193361.324650093.1367196659.1370199358.1370202384.19; __utmz=215193361.1367196659.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); connect.sid=s%3A8E7Ja9uzypmXXBKawm02-Q3I.srSznDz5BZiS4F2amcSmDqxuWB8hIk7zL6rMAwF0xec  
Pragma:no-cache
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36


**Response Headers**
view source
Accept-Ranges:bytes
Age:0
Cache-Control:max-age=300
Connection:keep-alive
Content-Encoding:gzip
Content-Length:46
Content-Type:text/plain
Date:Sat, 06 Jul 2013 16:19:57 GMT
Expires:Sat Jul 06 2013 16:24:57 GMT+0000 (UTC)
Server:nginx
Vary:Accept-Encoding
Via:1.1 varnish
X-Powered-By:Express
X-Varnish:2078531013

what is happening

coool
  • 8,085
  • 12
  • 60
  • 80

1 Answers1

0

I think there are two different issues:

  1. Varnish.- Varnish is receiving a Cookie in the request, so by default it wont't cache the answer[1].
  2. Chrome.- The server is answering with a "Pragma:no-cache" that's likely to avoid the Chrome caching of the item.

Anyway, debugging varnish cache issues without the actual VCL used is quite difficult.

[1] https://www.varnish-software.com/static/book/VCL_Basics.html#default-vcl-recv

NITEMAN
  • 1,236
  • 10
  • 11
  • 1
    server is not setting pragma:no-cache. It is the request header – coool Jul 08 '13 at 15:35
  • Excuse me, but the headers in the question where different when I saw them. Anyway, the varnish part of my response still stands. – NITEMAN Jul 11 '13 at 08:08