next.js
30e73d2d - docs: note that response headers must be set before calling handle() in a custom server (#97693)

Commit
46 days ago
docs: note that response headers must be set before calling handle() in a custom server (#97693) Fixes: #82387 A custom server that calls `res.setHeader()` after `await handle(req, res)` silently loses the header, because Next.js has already begun sending the response by the time `handle` resolves. Unlike a normal Node `setHeader()` after `headersSent`, this does not throw, so the header just never reaches the client. This adds a note to the custom server guide showing the correct ordering and pointing out that the same applies to framework wrappers such as `reply.raw` in Fastify.
Author
Parents
Loading