Hi, I am using SvelteKit with the Cloudflare adapter to build my website.
The build generates a
_worker.js and a
I also have a
_redirects file, which is parsed correctly.
For some reason the redirects stopped working.
On both, the custom and the
.pages.dev and my custom URl.
According to google indexing the change should have happened on the 11th of January.
My last deploy was on the 15th of December.
Can anyone tell me why?
Docs I used:
I’m having the exact same issue.
_redirects has been parsed correctly but takes no effect.
One workaround is to configure a redirect rule at the domain level.
However, still hoping this issue gets addressed eventually.
I now decided to use my own redirect library with SvelteKit.
Now it works without any issue
Redirects not working when your app is SSR’d is expected. Functions run before the asset asset handling and it’s that handling which applies these redirects/headers.
That makes no sense at all.
Redirects should always happen before the render function.
Also the documentation mentions nothing about the behavior.
That’s just the way it works, Functions run before the asset server. If we put the asset server first then Functions wouldn’t run
When it comes to Functions, it’s completely in your control, we don’t want to takeover and suddenly do unexpected behavior.
Custom headers defined in the
_headers file are not applied to responses from Functions, even if the Function route matches the URL pattern. If your Pages application uses Functions, you must migrate any behaviors from the
_headers file to the
Response object in the appropriate
/functions route. When altering headers for multiple routes, you may be interested in adding middleware for shared behavior.
Actually, it does