【发布时间】:2015-03-11 22:52:32
【问题描述】:
使用节点 http-proxy 模块,我在使用 GET 代理到主机时没有问题。但是当我使用POST 和代理到同一个主机时,我得到Status Code:400 Bad Request 和HTTP message contains illegal headers。
我检查了proxyReq 标头,它们看起来不错,与成功获取时使用的完全相同的标头。
_headers:
{ 'x-forwarded-proto': 'http',
'x-forwarded-port': '9000',
'x-forwarded-for': '::ffff:10.3.117.47',
'accept-language': 'en-US,en;q=0.8',
'accept-encoding': 'gzip,deflate,sdch',
'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.101 Safari/537.36',
accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'cache-control': 'no-cache',
pragma: 'no-cache',
connection: 'close',
host: '10.1.1.1:9000',
'x-auth-token': 'tokenStuff'
}
附带说明,如果我在不使用代理的情况下直接向代理主机发出相同的 api 调用,我不会收到此消息。相同的帖子和 json 有效负载和标头
【问题讨论】:
标签: node.js proxy http-headers node-http-proxy