T
TanStack5mo ago
fascinating-indigo

How can I set HTTP response code during SSR?

When I throw errors in root loader, it still returns 200, though it shows my error component properly. "setResponseCode" seems to not change anything. Throwing "notFound()" and "redirect()" seems to work for their respective purposes, but I want a 500 error page (or any arbitrary status code page).
3 Replies
extended-salmon
extended-salmon5mo ago
Are you using the "useServerFunction" hook?
fascinating-indigo
fascinating-indigoOP5mo ago
In the route's loader() I didn't think it was needed, though I can try it in a bit.
extended-salmon
extended-salmon5mo ago
I am sorry, I missed this detail

Did you find this page helpful?