proxy-chain send one header with unique name
shershennm opened this issue · comments
Mikalai commented
If request have multiple headers with same name, proxy-chain will leave only one (last). Example:
const http = require('http');
const ProxyChain = require('proxy-chain');
const server = http.createServer((req, res) => {
res.writeHead(200, [['Set-Cookie', 'foo=bar; path=/; HttpOnly'], ['Set-Cookie', 'bar=foo; path=/; HttpOnly']])
res.end();
}).listen(3000);
const proxyServer = (new ProxyChain.Server()).listen(8000);
Without proxy: curl 127.0.0.1:3000 -vvv
> GET / HTTP/1.1
> Host: 127.0.0.1:3000
> User-Agent: curl/7.55.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Set-Cookie: foo=bar; path=/; HttpOnly
< Set-Cookie: bar=foo; path=/; HttpOnly
< Date: Mon, 18 Dec 2017 09:18:05 GMT
< Connection: keep-alive
< Transfer-Encoding: chunked
With proxy: curl -x 127.0.0.1:8000 127.0.0.1:3000 -vvv
> GET http://127.0.0.1:3000/ HTTP/1.1
> Host: 127.0.0.1:3000
> User-Agent: curl/7.55.1
> Accept: */*
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 200 OK
< Set-Cookie: bar=foo; path=/; HttpOnly
< Date: Mon, 18 Dec 2017 09:17:49 GMT
< Connection: keep-alive
< Transfer-Encoding: chunked
Marek Trunkát commented
Fixed and published. Thx @shershennm