_header and toml cache not working

I’ve tried setting up cache for a new website, however it is not showing up in dev tools > application > cache storage. GTMetrix and other speed tools are also advising to add expires header.

I’ve added a _headers file to the root, however that didn’t work… I’ve also added headers rules to the netlify.toml file, but again this did not work.

I’ve tripple checked my formatting and can’t see anything wrong.

Is there a specific way the site should be built for this to work? (I’m using nextjs with build command npm run build - the site get’s built fine … just the headers aren’t showing up)

Any assistance would be greatly appreciated!

Here’s the formats of what I’m trying to get working…

_headers file:

/*
  Cache-Control: public, max-age=3600, immutable

netlify.toml file:
[[headers]]
  for = "/*"
  [headers.values]
    cache-control = '''
	  max-age=3600,
	  public'''
[build]
  command   = "npm run build"
  functions = "out_functions"
  publish   = "out_publish"

We’ll need to know what site you’re working with to be able to check what you deployed. Usually the problem is that peoples’ headers file was not correctly deployed…

Thanks for responding! I think that a deploying issue was the cause - I cleared the build cash and re-deployed and it worked :slight_smile: