_headers with SvelteKit not applied?
heya, on my SvelteKit site using the
cloudflare-pages
adapter, I have a _headers
file with this content and these show in the Headers tab of my CF deployment but the headers don't show in my network tab requests, any idea why? 🤔
4 Replies
curious to know why if any of you have an idea ✌️
If you are server-side rendering (SSR) or using Pages Functions to generate responses, they won't be applied
https://svelte.dev/docs/kit/adapter-cloudflare#Headers-and-redirects
The _headers and _redirects files, specific to Cloudflare, can be used for static asset responses (like images) by putting them into the project root folder. However, they will have no effect on responses dynamically rendered by SvelteKit, which should return custom headers or redirect responses from server endpoints or with the handle hook.
Cloudflare Pages • Docs • Svelte
Cloudflare Pages • Svelte documentation
@Chaika yes I use SvelteKit with SSR but this worked before 🤔 did this changed recently?
I've literally had the same file for months and it added these headers to every request
I ended up using the csp option in the svelte config and a handle in my hooks file, works fine but still curious of why this changed