Rewriting status code from middleware #46716
Unanswered
ethanhoroschak
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
I have some pages that currently return 404 status codes that I'd like to change to 410. Since these pages are statically generated, I'm using middleware to detect which pages and then calling

return NextResponse.rewrite(new URL('410', request.url), { status: 410 })where /410 is a copy of the 404 page I made. This seems to temporarily do what I want, but then very soon I getUnhandled runtime error: Failed to load static props. If I don't change the status on the rewrite, this error doesn't occur.Additional information
Using next v12.3.4
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions