_headers file and Astro
Hi all, new to CF Pages and Astro (static generated). Even so, I've managed to create a nice blog site pretty quickly.
However, I want to make use of some custom headers but I can't figure out how to make the Astro build process create a file called
_headers
in the dist root folder. If I create a /src/pages/_headers.js
, the Astro build ignores it. If I rename to headers.js
it produces the correct output but with the wrong name,
Can anyone guide me to the correct process please? Thanks.3 Replies
Files under
/src/
are processed by Astro. For _headers
you want it to be used as-is as a static asset, so it should be in your directory for static assets, which is /public/
by default.Hi, thanks for your response. However, the
_headers
file isn't a static asset, it is a private file used by Cloudflare Pages and most certainly should not be publicly available. I just can't work out how to get this to work with Astro.