T
TanStack2mo ago
generous-apricot

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
rival-black
rival-black2mo ago
Are you using the "useServerFunction" hook?
generous-apricot
generous-apricotOP2mo ago
In the route's loader() I didn't think it was needed, though I can try it in a bit.
rival-black
rival-black2mo ago
I am sorry, I missed this detail

Did you find this page helpful?