-
Notifications
You must be signed in to change notification settings - Fork 290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debate about whether headers are included in proxied request #1276
Comments
So yeah my question is - are the original headers included or not? |
No, they're not. |
Yeah ok, makes sense, to include them, just do this? // first write headers
Object.keys(headers).forEach(function(k){
proxy.write(`${k}\t${headers[k]}\r\n`);
});
// one more newline I think
proxy.write('\n');
// then write body
clientRequest.pipe(proxy); |
No, that creates an outgoing request with headers in the request body. Add them as the Take a look at https://github.com/nodejitsu/node-http-proxy. |
Yeah I tried adding the headers to the options arg, but I got some JSON parsing errors which I thought was very strange. |
Guessing that this issue is resolved. /cc @ORESoftware and @the1mills (by this time I also have guessed you two are same) |
closing as addressed, please let me know if that is not the case |
I am on the latest Node.js versions v9, v10, etc. I have a simple server which proxies the npm registry:
I have a debate raging here about whether the original request headers are included in the request that gets sent to NPM:
https://stackoverflow.com/questions/50342072/why-doesnt-node-js-proxy-request-need-headers-included?noredirect=1#comment87711085_50342072
The text was updated successfully, but these errors were encountered: