Netlify ignores cache-control for 304

The default cache-control header has a heavily negative impact on my web app. Content is generated dynamically as you navigate through the app. Images are constantly being reused but without cache they involve a delay which is clearly noticeable.

This slows down navigation a lot and is not acceptable. But it should be ok because you can change the header. So I set this netlify.toml:

  for = "*"
    cache-control = "public, max-age=600"

That works like a charm for a while. But after a few minutes Netlify goes back to serving the default header and the annoying experience comes back with it.

Why? How can we solve this?


After a lot of testing I finally found the reason.

Netlify ignores the cache-control header configuration for 304 responses (etag matches) and ALWAYS sends the default one. This is extremely annoying since I already distributed the link though Netlify and it makes the apps look a lot slower…

I need some kind of solution please

1 Like

Hi Luis,

We’re still working on this case in the helpdesk with you and the team will be able to reconsider your results next week when we have some bandwidth. We’ll follow up in community too once we come to some conclusion.

@luiscastro193, I’ve followed up with in our helpdesk ticket. It looks like our system parses custom headers in a case sensitive way. As a workaround, I have suggested defining the header like so:

Cache-Control = "public, max-age=600"

Can you confirm if this works for you?

It doesn’t:

As always 200 responses are fine but 304 responses go back to the default Cache-Control.

This is the config file:

Ah ok. It looks like a new issue then. I’ll get that filed as well and will update here if and when we get a fix deployed. Unfortunately, I don’t have a workaround for it at this time.

Edit: Actually, checking the page a few minutes after initial deploy, images are flickering again. For some reason, the headers settings in netlify.toml don’t seem to stick for long.

I can confirm the same issue with our demo site - currently evaluating Netlify / NetlifyCMS for our company site at

304 responses go back to default Cache-Control, leading to noticeable flickering when navigating between pages that use the same image files.

The issue is jarring when using Firefox, less so when using Chrome.

As a workaround, I’ve added the following settings to my netlify.toml - this removes the flickering, with max-age being short enough to invalidate content quickly.

Ideally, we probably wouldn’t have to use this settings, so adding this comment for future reference and to be kept in the loop regarding updates :slight_smile:

  for = "*.jpg"
    Cache-Control = "public, max-age=300"

  for = "*.png"
    Cache-Control = "public, max-age=300"
1 Like

@MatsLanGoH, we appreciate your thoughts on this. We will update this topic if/when the behavior is corrected. Also, please feel free to “watch” this topic (there is a button below) if you want to receive emails about any updates here.

Last but not least, welcome to our community site! :slightly_smiling_face:

1 Like

Has this been solved? I believe this may be what is affecting me here

Hi, @Rangoli-Software.

I replied in the topic you linked to above. I believe the issue you are experiencing is unrelated to the 304 status issue.

The issue filed for the 304 responses not sending custom headers remains open. It is not resolved at this time. (Again, though, I don’t think it is the root cause of the issue you are seeing.)

A fix for this issue would be appreciated.
For development purpose, we need to totally disable cache management on server-side, but this “304” behaviour breaks our application :cry:

Our configuration:

  Cache-Control: no-cache no-store must-revalidate max-age=0

Thank you

It is much better with , between instructions!

This is working great:

  Cache-Control: no-cache, no-store, must-revalidate, max-age=0
1 Like

Hi, @dlecan. If/when the 304 issue is resolved, we’ll post another update here. (This issue is still open at this time.)

Hey @luke,
Any updates on this issue ? Could this be related behaviour I’m seeing in this thread.

Sorry, we don’t have an update yet. However, looking at your thread, it does look to be the same 304 issue so you’ll want to keep an eye on this thread. We’ll update this thread once we’ve resolved the issue. Thank you for your patience.

Has this issue been resolved yet?

I have the same caching issue on my site.

The weird thing is, there weren’t any problems with the cache-control header until a few days ago. When I checked it at least 4 days ago (right after the last build), it definitely worked.

The caching issue was discovered exactly 10 minutes ago from now.

This is my netlify.toml:

  for = "/*"
    Access-Control-Allow-Origin = "*"
    cache-control = "public, max-age=3600"

Hey there, @salmonspace !

Thank you for sharing this with us. Unfortunately, I do not have an update or an ETA on this. As Dennis mentioned above, we will update this thread once the issue is resolved.

Thank you for your patience!


Was this issue already resolved? I have the same (a similar?) issue on my site:

When reloading, the images are always refetched ignoring the cache settings, even when navigating back and forth. I have tried to change the cache headers with the netlify.toml:

  for = "/images/*"

    cache-control = '''

Hi @nirazul,

The issue sadly still exists.

I’m interested in this issue as well, since I was troubleshooting why my cache-control headers weren’t working for over an hour; I double-checked whether I was writing my rules correctly in the Netlify Playground, I split out my glob into multiple individual sections, and I added a custom x-does-this-work="true" header on the off-chance it was a problem with cache-control specifically.

But IG it’s just that we need a method to set custom headers per response code?

Would it be possible to borrow from the redirects syntax?


  for = "/*"
  status = "304"
    Cache-Control = "public, max-age=0, stale-while-revalidate"