I’m setting HTTP Response Headers for the static site as in the following recipe: NGINX | Deployment | Vite PWA
Request Path |
Header Name |
Header Value |
/* |
Cache-Control |
public, max-age=0, s-maxage=0, must-revalidate |
/assets/icon/* |
Cache-Control |
public, max-age=3600, s-maxage=3600, immutable |
/robots.txt |
Cache-Control |
public, max-age=3600, s-maxage=3600, immutable |
However the effective response headers for request with an url
https://host.com/assets/icon/favicon.svg
are:
Cache-Control: public, max-age=0, s-maxage=0, must-revalidate
but for
https://host.com/robots.txt
are:
Cache-Control: public, max-age=3600, s-maxage=3600, immutable
Why is so?
The Request Path for assets/icon/favicon.svg
is more specific then first one and listed below it.
Are the rewrites listed in that order on the Render Dashboard as well? Redirects and rewrites have a “first-match, top-to-bottom” priority: https://render.com/docs/redirects-rewrites#rule-matching-and-ordering
My question is about HTTP Headers for Static Sites, not Redirects and Rewrites.
If same logic “first-match, top-to-bottom” applies for HTTP Headers, this means I should revert order in case from most specific to least specific?
However that’s how I’ve stared - all headers were served with Cache-Control: public, max-age=0 s-maxage=0, must-revalidate
, then I switched to order outlined in topic description.
Update:
Response Headers for single URL are at one time
Cache-Control: public, max-age=0, s-maxage=0, must-revalidate
the few seconds later
Cache-Control: public, max-age=3600, s-maxage=3600, immutable
I have no idea what’s going on