1

I am implementing API in NestJs and new to this framework. For one of my API I am getting error as

Status Code: 431 Request Header Fields Too Large

To fix this issue I want to change max header size in NestJs configuration. Where do I change this configuration in NestJs application.

CodeWarrior
  • 763
  • 3
  • 14
  • 33

2 Answers2

0

This question is already answered for node here and for nest you can pass the argument as same as for node:

nest start -- --max-http-header-size=80000

As it's explained here

NestJS is a framework for NodeJS, you can pass NodeJS params directly, so I think this could be useful for you NodeJS command line options

And in case you want to set it from the code you can follow the same idea as this post explains something bodyparser is available for both.

I hope this is useful for you.

0

I could not get this to work by forwarding the node argument the way it's done in the currently accepted answer. Perhaps this is specific to my environment, but I was able to get it working using Nest's exec argument:

nest start --exec "node --max-http-header-size=40960"

The official description of the exec argument:

Binary to run (default: node).

https://docs.nestjs.com/cli/usages#nest-start