1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-11-13 03:35:52 +01:00

feat: introduce server keepAliveTimeout into config files

Set default timeout to 60 seconds (it's workaround for issue reported in issues/301).
This commit is contained in:
Rostislav Simonik 2019-01-27 10:19:46 +01:00
parent 2c229cc319
commit a3590558d7
3 changed files with 16 additions and 1 deletions

@ -50,6 +50,12 @@ packages:
# if package is not available locally, proxy requests to 'npmjs' registry # if package is not available locally, proxy requests to 'npmjs' registry
proxy: npmjs proxy: npmjs
# You can specify HTTP/1.1 server keep alive timeout in seconds for incomming connections.
# A value of 0 makes the http server behave similarly to Node.js versions prior to 8.0.0, which did not have a keep-alive timeout.
# WORKAROUND: Through given configuration you can workaround following issue https://github.com/verdaccio/verdaccio/issues/301. Set to 0 in case 60 is not enought.
server:
keepAliveTimeout: 60
# To use `npm audit` uncomment the following section # To use `npm audit` uncomment the following section
middlewares: middlewares:
audit: audit:

@ -115,6 +115,12 @@ packages:
# - [::1]:4873 # ipv6 # - [::1]:4873 # ipv6
# - unix:/tmp/verdaccio.sock # unix socket # - unix:/tmp/verdaccio.sock # unix socket
# You can specify HTTP/1.1 server keep alive timeout in seconds for incomming connections.
# A value of 0 makes the http server behave similarly to Node.js versions prior to 8.0.0, which did not have a keep-alive timeout.
# WORKAROUND: Through given configuration you can workaround following issue https://github.com/verdaccio/verdaccio/issues/301. Set to 0 in case 60 is not enought.
server:
keepAliveTimeout: 60
# Configure HTTPS, it is required if you use "https" protocol above. # Configure HTTPS, it is required if you use "https" protocol above.
#https: #https:
# key: path/to/server.key # key: path/to/server.key

@ -89,7 +89,10 @@ function startVerdaccio(config: any,
} else { // http } else { // http
webServer = http.createServer(app); webServer = http.createServer(app);
} }
if (config.server && config.server.keepAliveTimeout) {
// $FlowFixMe library definition for node is not up to date (doesn't contain recent 8.0 changes)
webServer.keepAliveTimeout = config.server.keepAliveTimeout;
}
unlinkAddressPath(addr); unlinkAddressPath(addr);
callback(webServer, addr, pkgName, pkgVersion); callback(webServer, addr, pkgName, pkgVersion);