Cache not working: Add 'expires', 'last-modified' Headers and 304 response (Joined files)
See original GitHub issueThe browsers are preventing the cache of my assets files, but can cache Cloudflare assets.
I only find this differences in the Cloudflare response:
- HTTP/2.0 304 Not Modified (instead of HTTP/2.0 200 OK)
- expires: Wed, 27 May 2020 13:58:38 GMT (only in Cloudflare)
- last-modified: Mon, 25 Mar 2019 19:00:55 GMT (only in Cloudflare)
jsDelivr, browser can’t cache: https://cdn.jsdelivr.net/combine/npm/short-and-sweet@latest/dist/short-and-sweet.min.js,npm/popper.js@latest/dist/umd/popper.min.js,npm/jquery-vjs-rails@latest/src/rails.min.js,npm/bootstrap@latest/dist/js/bootstrap.bundle.min.js,npm/plyr@latest/dist/plyr.min.js
HTTP/2.0 200 OK
access-control-allow-origin: *
access-control-expose-headers: *
timing-allow-origin: *
cache-control: public, max-age=604800, s-maxage=43200
x-content-type-options: nosniff
strict-transport-security: max-age=31536000; includeSubDomains; preload
content-type: application/javascript; charset=utf-8
etag: W/"376e1-lMU9JDqadUOS2SxkCDLVN+IefOg"
content-encoding: gzip
accept-ranges: bytes
date: Fri, 07 Jun 2019 13:58:38 GMT
x-served-by: cache-ams21023-AMS, cache-gru17122-GRU
x-cache: MISS, HIT
vary: Accept-Encoding
content-length: 64038
X-Firefox-Spdy: h2
Cloudflare CDN, browser can cache: https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.8.1/css/all.min.css
HTTP/2.0 304 Not Modified
date: Fri, 07 Jun 2019 13:58:38 GMT
last-modified: Mon, 25 Mar 2019 19:00:55 GMT
etag: W/"5c992567-d747"
expires: Wed, 27 May 2020 13:58:38 GMT
cache-control: public, max-age=30672000
vary: Accept-Encoding
timing-allow-origin: *
access-control-allow-origin: *
served-in-seconds: 0.021
cf-cache-status: HIT
strict-transport-security: max-age=15780000; includeSubDomains
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
server: cloudflare
cf-ray: 4e3324585963d03c-GRU
X-Firefox-Spdy: h2
I know individual files are better for cache but the joined solved many performance problem in my projects. If possible, I want to use the joined file with cache headers.
One of my browsers: https://www.mozilla.org/en-US/firefox/channel/desktop/#nightly
Thanks!
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (3 by maintainers)
Top GitHub Comments
We use etags instead of last-modified so the request should include something like
if-none-match: W/"376e1-lMU9JDqadUOS2SxkCDLVN+IefOg"
If it isn’t there it’s most likely an issue with your browser configuration or an addon.
@MartinKolarik I found problems with that extension and the cache: https://addons.mozilla.org/pt-BR/firefox/addon/chameleon-ext/
Cache working well after add-on disable. Thanks again.