create-react-app-buildpack
create-react-app-buildpack copied to clipboard
Cache-Control Static.json Clarification
I'm unsure whether to add a Cache-Control header on the route /
or on /index.html
.
I'm having issues with users seeing older versions of the app. I want to ensure that on subsequent load of the app - they get the latest version without sacrificing the performance of the app as mentioned in #52.
Should I add the "Cache-Control" header for the root /
or /index.html
?
Option 1
{
"root": "build/",
"https_only": true,
"headers": {
"/**": {
"Strict-Transport-Security": "max-age=31536000; includeSubDomains;",
"X-Frame-Options": "DENY",
"X-XSS-Protection": "1; mode=block",
"X-Content-Type-Options": "nosniff"
},
"/index.html": {
"Cache-Control": "no-store, no-cache"
}
},
"routes": {
"/**": "index.html"
}
}
Option 2
{
"root": "build/",
"https_only": true,
"headers": {
"/**": {
"Strict-Transport-Security": "max-age=31536000; includeSubDomains;",
"X-Frame-Options": "DENY",
"X-XSS-Protection": "1; mode=block",
"X-Content-Type-Options": "nosniff"
},
"/": {
"Cache-Control": "no-store, no-cache"
}
},
"routes": {
"/**": "index.html"
}
}
I'm having the same issue described above. I added
"headers": {
"/**": {
"Cache-Control": "no-store, no-cache"
}
}
in my static.json
file, but I'm still seeing an old version of the app after deploying. Any suggestion?