Cache headers detection

Hi there,

I have an issue when testing
Webpagetest is telling me that the two following resources have no max-age or expires headers:

However, when using F12 or Fiddler to double check, I can see the following headers, with an expiration date set to 1 year:
Cache-Control: public
Content-Encoding: gzip
Date: Mon, 20 Aug 2018 09:56:42 GMT
Expires: Tue, 20 Aug 2019 09:56:43 GMT
Last-Modified: Mon, 20 Aug 2018 09:56:43 GMT
Vary: User-Agent,Accept-Encoding

Am I doing something wrong?

Thanks a lot.


Not entirely sure. The code is definitely getting tripped up because there is both a Cache-Control header and an Expires header. Usually Cache-Control is preferred if it is present but in this case the Cache-Control header doesn’t include a max-age and just includes public:

HTTP/1.1 200 OK
Cache-Control: public
Transfer-Encoding: chunked
Content-Type: text/css; charset=utf-8
Content-Encoding: gzip
Expires: Fri, 23 Aug 2019 17:45:02 GMT
Last-Modified: Thu, 23 Aug 2018 17:45:02 GMT
Vary: User-Agent,Accept-Encoding
Date: Thu, 23 Aug 2018 17:45:01 GMT

I honestly don’t know how browsers will react to that. If possible, I’d encourage changing the Cache-Control to be “public, max-age=31536000”.

Thanks a lot Patrick.
I’m not sure neither if that was really an issue or not, but I’ve added the max-age directive to the response just in case.