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

Make bounced requests default to non-persistent. #10

Closed
wants to merge 1 commit into
from
Jump to file or symbol
Failed to load files and symbols.
+7 −0
Split
View
@@ -77,6 +77,13 @@ function makeBounce (bs, client, req) {
opts.headers['x-forwarded-proto'] =
client.encrypted ? 'https' : 'http';
}
+ if (!('Connection' in opts.headers)) {
+ // By default, with HTTP/1.1 all connections are persistent.
+ // If we leave them persistent, then we'll keep a lot of
+ // unnecessary connections around, resulting in slowness and
+ // "possible EventEmitter memory leak detected" warnings.
+ opts.headers['Connection'] = 'close';
+ }
insertHeaders(bs.chunks, opts.headers);