serverless-offline icon indicating copy to clipboard operation
serverless-offline copied to clipboard

Long header value causes 431 on requests

Open novumcoder opened this issue 3 years ago • 2 comments

Hi, i need to send an authorization token with a length of nearly 9000 characters.

That causes the offline server to respond with 431 - Request Header Fields To Large.

Is there any possibility to make it accept such big headers? I didn't find any option for it.

novumcoder avatar Aug 11 '22 17:08 novumcoder

that might be a node.js limitation. you could try to change the header max size for node.js: https://nodejs.org/api/cli.html#--max-http-header-sizesize

dnalborczyk avatar Aug 11 '22 22:08 dnalborczyk

@dnalborczyk i know that, but how do i push that param into a call like "serverless offline --stage xyz" ?

novumcoder avatar Aug 12 '22 09:08 novumcoder

there's multiple ways, this is one possibility: NODE_OPTIONS="max-http-header-size=9000" serverless offline --stage xyz

dnalborczyk avatar Aug 12 '22 12:08 dnalborczyk

@dnalborczyk cool, that is what i was looking for. thanks.

novumcoder avatar Aug 13 '22 21:08 novumcoder