#451: UNAVAILABLE_FOR_LEGAL_REASONS
1 messages · Page 1 of 1 (latest)
Hi @wicked nebula. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
It seems like you are encountering a 451: UNAVAILABLE_FOR_LEGAL_REASONS status code across all your projects. This status code typically indicates that the content is unavailable due to legal reasons, such as government-mandated censorship or legal restrictions.
From the knowledge sources provided, there is a relevant discussion about handling custom status codes, including 451, in Next.js middleware. Here is an example of how you can return a 451 status code using NextResponse:
if (some_condition) {
return new NextResponse(
JSON.stringify({ message: 'service not available' }),
{
status: 451,
headers: { 'content-type': 'application/json' }
}
);
}
However, this approach only allows you to return static content with the custom status code. If you need to display a Next.js rendered page with a 451 status code, this functionality is currently not supported directly by NextResponse.rewrite.
For more details, you can refer to the discussion in the GitHub issue (https://github.com/vercel/next.js/issues/50155).
If you are seeing this status code unexpectedly across all your projects, it might be worth checking if there are any legal restrictions or configurations applied at a higher level, such as your hosting provider or network settings.