AaronP
November 6, 2020, 10:59am
6
It has been mentioned a few times as far as I can see but it would be good if it was explicitly in the docs. I’ll tag @perry for you to get a Netlify employee’s response for you
You can modify headers for any file that isn’t asset-optimized (since those have the special handling, but also potentially create CORS problems since they are served from a different domain). You do this using our custom headers functionality:
For those two, you might use this in your separate headers file, or your toml file though that configuration being more verbose I don’t include it here:
/path/to/therapist.js:
cache-control: public, max-age=31556926
/path/to/session.js
cache-co…
You won’t be able to set custom headers on assets that we optimize - if you need to set custom headers on an asset (hopefully you aren’t changing the cache-control - we advise against that and it isn’t needed on our system), you’ll have to disable asset optimization and redeploy to make that work.