Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Don't override 'connection' header if was set by the target server #260

Closed
wants to merge 3 commits into
from

Conversation

Projects
None yet
2 participants
Contributor

gilad61 commented Jun 12, 2012

In http-proxy.js line 227 - if the original request didn't have a 'connection' header, and the target server set this header to any value, it will always be overridden and set to 'close'.
This proposed fix set the connection header only if not already set by the target server.

Contributor

gilad61 commented Jul 19, 2012

Adding another fix -
If response headers are copied using the res.writeHead() function, then the copy is case sensitive. It means that eventually we may have two headers with same name but different casing, for example: x-My-Header: "a", x-my-header: "b".
HTTP headers are case insensitive, so the copy needs to be done with res.setHeader(), which overrides existing headers case-insensitively.

Owner

indexzero commented Jul 22, 2012

Could you try adding tests for this? It would be greatly appreciated.

@gilad61 gilad61 closed this Jul 31, 2012

Contributor

gilad61 commented Jul 31, 2012

Closing this pull request, and opening a new one instead #294 (#294)
The new pull request also contains tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment