Next.js Discord

Discord Forum

[App Router] How to set a custom header based on HTTP Response status of the page ?

Unanswered
Asari posted this in #help-forum
Open in Discord
AsariOP
Hi Everyone,

Do you have any idea how to return a different header based on status code of the page with App Router ?
For example I have a page when it's 200 (Success case) I want to return a specific header
When it's a 500 I want to return another header

https://github.com/vercel/next.js/discussions/75515#discussion-7897673

1 Reply

AsariOP
Hi @Multiflora rose seed chalcid

I am wondering if you had this challenge once or not ?