2 years ago
Hey Everyone! Set up a next.js rewrite from my NextJS application
myapp.io/api/ -> the railway URL
Unfortunately the cookie size is very large due to JWTs and we're getting Request Header Fields Too Large. The backend doesn't even need to use this cookie, and there's no way to omit it from NextJS's end without creating and paying for custom middleware.
Is there any way to set up Railway to ignore the Cookie header? instead of returning the Request Header Fields Too Large error
16 Replies
2 years ago
can you provide a screenshot of this error?
i think you can only reproduce if logged into joylink.io actually since that's what sets the cookie
2 years ago
iirc the header limit is 8KB, i can't see us increasing that anymore unfortunately
2 years ago
we do not provide that kind of functionality
2 years ago
Hi, the solution to this is (unfortunately) better token design. You should only be storing core information in the JWT token anyways, such as a unique identifier for the user and the barebones information that is required to make the site work. For example, if you're storing the entire user object in the JWT and only accessing the SUB (uid) for authentication (assuming your payload is signed), you should really only be storing the SUB on that token.
2 years ago
>Unfortunately the cookie size is very large due to JWTs and we're getting Request Header Fields Too Large. The backend doesn't even need to use this cookie, and there's no way to omit it from NextJS's end without creating and paying for custom middleware.
2 years ago
I can't read
2 years ago
Can you tell me which cookie it is?
2 years ago
Oh well, I can't even sign into it because "API Key required" or something
2 years ago
oh well
2 years ago
Pretty cool product tho btw