check-gatsby-caching
Validates your caching headers for your Gatsby site.
Run in your terminal
npx check-gatsby-caching https://url-of-your-gatsby-site.com
Category: JavaScript / Miscellaneous |
Watchers: 1 |
Star: 14 |
Fork: 0 |
Last update: Oct 12, 2021 |
When deploying a Gatsby site with pathPrefix, like:
https://www.example.com/prefix/
the output of the tool is this:
Validating headers for the Gatsby site: https://www.example.com/prefix/
HTML
https://www.example.com/prefix/
✅ headers are correct!
app-data.json
https://www.example.com/prefix/page-data/app-data.json
✅ headers are correct!
Page Data
https://www.example.com/prefix/prefix/page-data\index\page-data.json
❌
- Expected
+ Received
Object {
- "max-age": 0,
- "must-revalidate": true,
- "public": true,
+ "null": "No cache-control header set",
}
JavaScript and CSS
https://www.example.com/prefix/prefix/webpack-runtime-4cd53e51decca410c49d.js
❌
- Expected
+ Received
Object {
- "immutable": true,
- "max-age": 31536000,
- "public": true,
+ "null": "No cache-control header set",
}
It seems to fail to call the correct files to check the headers for (the last two get 404, because the prefix is repeated and the url is wrong), while the gatsby site calls them correctly, so the pathPrefix is properly configured.
tool says:
npx check-gatsby-caching https://[redacted]
npx: installed 230 in 7.786s
Validating headers for the Gatsby site: https://[redacted]
HTML
https://[redacted]
✅ headers are correct!
app-data.json
https://[redacted]/page-data/app-data.json
❌
- Expected
+ Received
Object {
- "max-age": 0,
- "must-revalidate": true,
- "public": true,
+ "null": "No cache-control header set",
}
Page Data
https://[redacted]/page-data/index/page-data.json
❌
- Expected
+ Received
Object {
- "max-age": 0,
- "must-revalidate": true,
- "public": true,
+ "null": "No cache-control header set",
}
JavaScript and CSS
https://[redacted]/webpack-runtime-d068a770423a88d3d9a5.js
✅ headers are correct!
curl says:
curl -I https://[redacted]/page-data/app-data.json
HTTP/2 200
date: Mon, 08 Feb 2021 12:09:52 GMT
content-type: application/json
content-length: 50
server: openresty
last-modified: Mon, 08 Feb 2021 11:14:50 GMT
etag: "0c453a4621603397e69b7cd0b78c37a8"
cache-control: public, max-age=0, must-revalidate
accept-ranges: bytes
x-robots-tag: noindex, nofollow
x-cache-status: MISS
which one is correct? :/ does the tool cache something?