Next.js Discord

Discord Forum

Getting 431 Errors when using Next 13 middleware

Unanswered
Argente Brun posted this in #help-forum
Open in Discord
Argente BrunOP
I've seen some other mentions of this error, but no concrete solutions. I have 4 authentication cookies I send to my API, which is hosted outside of our (self-hosted; Docker) NextJS server. If I clear out the cookies in middleware.ts using
response.headers.set('x-middleware-request-cookie', '')

the request will passthrough, but lacks the cookies I need on our backend. We've exhausted nearly everything to get this working, even upgrading to Next14 and trying to add NODE_OPTIONS='--max-http-header-size=204800' to our Docker environment, but that doesn't seem to be working either. This was not an issue for us before we migrated from Next 12 to Next 13. Has anyone dealt with similar?

0 Replies