Closed Brendonovich closed 1 month ago
Latest commit: 826311565f32d8c615274c69f5ba019973260664
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
I wonder if we could just support it? This code was copied from old SolidStart. But like router does send back redirects now so maybe that clause could just be removed? Have you tried it?
Yeah copying how navigateFromRoute
does server redirects seems to work. This does introduce the possibility for some server redirects to get blocked by CORS bc cross-origin, but that's probably something the developer should deal with.
else if (isServer) {
const e = getRequestEvent()!;
e.response = { status: 302, headers: new Headers({ Location: url }) };
return;
}
Currently, absolute redirects done inside
cache
on the server are (funnily enough) only performed when the cached function is also called insideload
. I'm not exactly sure howload
is involved to make that the case, but this PR seems to fix it.Instead of server-side absolute redirects just being ignored in
handleResponse
by an early return, which results in the redirect Response not being serialized and processed on the client insidecache
, the early return will only be done if the response has actually been handled. This change results inload
not having any effect on the redirect behaviour, and absolute redirects will always be passed through from the server to be handled on the client.Forcing absolute redirects onto the client works fine and avoids any CORS cross-origin redirect problems, but should there be an option for server-side absolute redirects to be properly supported?
Closes #438