如何更改请求头限制

我在我的localhost:3000上启动了节点express

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

但如果我尝试跟着…

curl -H'samlresponse:{这里是整个samlresponse,这是非常长的..大约20k ..} -v http:// localhost:3000

服务器总是返回“空的答复从服务器”,有没有办法来通过或修复这个问题?

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 (eg -DHTTP_MAX_HEADER_SIZE=<value>). To remove * the effective limit on the size of the header, define the macro * to a very large number (eg -DHTTP_MAX_HEADER_SIZE=0x7fffffff) */ #ifndef HTTP_MAX_HEADER_SIZE # define HTTP_MAX_HEADER_SIZE (80*1024) #endif 

所以,你可能需要从源码重build节点超过80*1024的限制。 但是,我个人认为,这是足够大的头,你应该重新判断你的statergy是否正确。