@astrojs/vercel: the /_astro/* immutable cache rule sits after { "handle": "filesystem" }, so hashed assets are served with max-age=0
Versions: astro 7.2.9, @astrojs/vercel 11.0.8, output: 'server', deployed on Vercel.
What happens. The adapter writes this route into .vercel/output/config.json:
{ "src": "^/_astro/(.*)$", "headers": { "cache-control": "public, max-age=31536000, immutable" }, "continue": true }but places it directly after { "handle": "filesystem" } (in our build: filesystem handle at
index 230, the /_astro rule at 231). Once the filesystem phase serves a file the request is
done, so the rule never runs for the files it targets. On a live deployment every content-hashed
chunk under /_astro/ came back cache-control: public, max-age=0, must-revalidate.
Expected. The /_astro header rule (a continue: true rule) placed before the filesystem
handler, so the static, content-hashed files get the immutable header.
Repro. Any project with @astrojs/vercel and output: 'server': astro build, then look at
the order of the routes in .vercel/output/config.json; or deploy and curl -sI any
/_astro/*.js.
Workaround. A postbuild step that moves the rule above { "handle": "filesystem" }.
Source: withastro/astro