node.js - 如何更改请求 header 限制

标签 node.js express header request

我在 localhost:3000 上启动了 Node Express..

**curl -H 'samlresponse:12323' -v http://localhost:3000 ,正确返回数据。

但是如果我尝试遵循...

curl -H 'samlresponse:{这是整个 samlresponse,它很长..几乎 20k..}' -v http://localhost:3000

服务器总是返回“来自服务器的空回复”,有办法绕过或解决这个问题吗?

最佳答案

Source Code of node at github说:

/* Maximium header size allowed. If the macro is not defined
 * before including this header then the default is used. To
 * change the maximum header size, define the macro in the build
 * environment (e.g. -DHTTP_MAX_HEADER_SIZE=<value>). To remove
 * the effective limit on the size of the header, define the macro
 * to a very large number (e.g. -DHTTP_MAX_HEADER_SIZE=0x7fffffff)
 */
#ifndef HTTP_MAX_HEADER_SIZE
# define HTTP_MAX_HEADER_SIZE (80*1024)
#endif

因此,您可能需要从源重建 Node 以超越 80*1024 的限制。但是,我个人认为,对于 header 来说已经足够大了,你应该重新评估你的策略是否正确。

关于node.js - 如何更改请求 header 限制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38474938/

相关文章:

node.js - Feathersjs 管理员角色(或具有身份验证检查功能的 Feathers 中间件)

forms - 使用nodejs和connect-form上传文件

以 Python 方式将 header 添加到 csv 文件

html5 : using header or footer tag twice?

c - 我可以 #include 定义 DWORD 的最小 Windows header 是什么?

node.js - 使用 passport-saml : req. logout() 或 Strategy.logout() 或两者注销?

node.js - 使用 node-http-proxy 从 NodeJS 到 Apache 的反向代理不起作用

node.js - 如何在命令行终端(vty)中运行 Electron 二进制文件

javascript - 如何将客户端值从浏览器端传递到 Node.js Controller

node.js - 如何编写用于文件上传的 Node.js express API?