且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在React-Redux应用程序中修复431请求标头字段太大

更新时间:2023-08-18 15:22:04

我在Angular应用程序中也遇到了同样的问题.花了很多时间后,我发现问题与Node JS有关.我们使用的是Node JS v12.x.x,在此版本中,max-http-header-size从80KB减少到8KB.我拥有的auth令牌大约为10KB.这就是为什么当我重新加载应用程序时,浏览器开始为某些文件显示"431请求标头字段太大"错误.我已经更新了Node JS v14.x.x,它再次开始工作,因为在v14.0.0中,max-http-header-size已增加到16KB.

I had faced the same issue in my Angular Application. After spending a lot of time, I had found out that the issue is related with Node JS. We were using Node JS v12.x.x, and in this version, max-http-header-size reduced to 8KB from 80KB. And the auth token which I had was of around 10KB. That's why, when I reload the app, browser starts giving '431 request header fields too large' error for some of the files. I had updated the Node JS v14.x.x and it starts working again because in v14.0.0, max-http-header-size has been increased to 16KB.

希望这会有所帮助.