Skip to content

Commit eb39018

Browse files
committed
[api] Integrated a little more from Mikeal to make our return headers consistent
1 parent 6d08f24 commit eb39018

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/node-http-proxy.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ var createProxy = function () {
8181
server.emit('route', req, res, function (port, hostname) {
8282
var p = manager.getPool(port, hostname);
8383

84-
req.headers.Connection = req.headers.Connection || 'close';
8584
p.request(req.method, req.url, req.headers, function (reverse_proxy) {
8685
var data = '';
8786
reverse_proxy.on('error', function (err) {
@@ -113,6 +112,11 @@ var createProxy = function () {
113112

114113
// Add a listener for the reverse_proxy response event
115114
reverse_proxy.addListener('response', function (response) {
115+
if (response.headers.connection) {
116+
if (req.headers.connection) response.headers.connection = req.headers.connection;
117+
else response.headers.connection = 'close';
118+
}
119+
116120
// These two listeners are for testability and observation
117121
// of what's passed back from the target server
118122
response.addListener('data', function (chunk) {

0 commit comments

Comments
 (0)