Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable cache when --cache is set to 0. #245

Merged
merged 1 commit into from
Jul 7, 2017
Merged

Disable cache when --cache is set to 0. #245

merged 1 commit into from
Jul 7, 2017

Conversation

fabe
Copy link
Contributor

@fabe fabe commented Jul 7, 2017

This implements #224 and sets a Cache-Control: no-cache header when serving with serve -c 0 or serve -s -c 0. Had to manually set it because send doesn't allow string values for cacheControl.

@leo leo merged commit 6d60755 into vercel:master Jul 7, 2017
@leo
Copy link
Contributor

leo commented Jul 7, 2017

Wonderful, thanks!

@monolithed
Copy link

How to disable cache now? It seems these changes were removed? --debug?

@jespertheend
Copy link
Contributor

adding a serve.json file to my server root with this json worked for me

{
  "headers": [
    {
      "source" : "**",
      "headers" : [{
        "key" : "Cache-Control",
        "value" : "no-cache"
      }]
    }
  ]
}

@specious
Copy link

I'm using serve 12.0.1 and this configuration doesn't seem to be working.

The server responds with header:

Cache-Control: max-age=0

However, it also responds with HTTP status 304 Not Modified.

@damianobarbati
Copy link

@jespertheend is that still working for you? I see no cache headers being set at all with:

{
  "headers": [
    {
      "source" : "*.html",
      "headers" : [{
        "key" : "Cache-Control",
        "value" : "no-store"
      }]
    },
    {
      "source" : "*.(js|css|map|jpg|jpeg|gif|png|ico)",
      "headers" : [{
        "key" : "Cache-Control",
        "value" : "public; max-age=86400"
      }]
    }
  ]
}

@jespertheend
Copy link
Contributor

@damianobarbati I haven't used serve in a while to be honest, but on one of my old projects it seems to still be working. Though it's using serve 10.0.1

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

Successfully merging this pull request may close these issues.

6 participants