Skip to content
This repository has been archived by the owner on Jun 11, 2022. It is now read-only.

Cache-Control Static.json Clarification #190

Open
seanquinn opened this issue Jul 7, 2021 · 1 comment
Open

Cache-Control Static.json Clarification #190

seanquinn opened this issue Jul 7, 2021 · 1 comment

Comments

@seanquinn
Copy link

seanquinn commented Jul 7, 2021

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"
  }
}
@matteo95g
Copy link

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants