cache-control header being stacked

i want everything to be cached for 5 minutes but static assets (_astro) to be cached for longer but cloudflare is stacking them _headers
/_astro/*
Cache-Control: public, max-age=86400

/*
Cache-Control: public, max-age=300
/_astro/*
Cache-Control: public, max-age=86400

/*
Cache-Control: public, max-age=300
7 Replies
Techno
TechnoOP•7mo ago
James
James•7mo ago
The best solution here is to just remove the cache control header first before setting it. Add a ! Cache-Control line before you set them in _headers
GreyXor
GreyXor•7mo ago
@James Hi, I have the same issue here : https://discord.com/channels/595317990191398933/1369650520427593748 I'm not sure how to handle that
James
James•7mo ago
Did you also try this?
GreyXor
GreyXor•7mo ago
i don't understand this solution "remove the header first before setting it" 🤷 non clear to me sorry
Walshy
Walshy•7mo ago
it's being set on the /_astro/* rule and then set again on the /* rule. James is saying within the /* rule remove any existing cache-control header first before setting it (so that it doesn't append like you see)
Techno
TechnoOP•6mo ago
tried this, unsetting doesnt seem to work if its reset later exact same output in the same rule and creating 2 rules

Did you find this page helpful?