我在 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/