mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
Merge pull request #298 from Kami/connection_keep_alive_on_1_1
If HTTP 1.1 is used and backend doesn't return 'Connection' header, expicitly return Connection: keep-alive.
This commit is contained in:
commit
af9eb06e47
@ -240,7 +240,14 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
|
||||
//
|
||||
if (!response.headers.connection) {
|
||||
if (req.headers.connection) { response.headers.connection = req.headers.connection }
|
||||
else { response.headers.connection = 'close' }
|
||||
else {
|
||||
if (req.httpVersion === '1.0') {
|
||||
response.headers.connection = 'close'
|
||||
}
|
||||
else if (req.httpVersion === '1.1') {
|
||||
response.headers.connection = 'keep-alive'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove `Transfer-Encoding` header if client's protocol is HTTP/1.0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user