Skip to content

Commit

Permalink
feat: introduce server keepAliveTimeout into config files
Browse files Browse the repository at this point in the history
Set default timeout to 60 seconds (it's workaround for issue reported in issues/301).
  • Loading branch information
rostislav-simonik committed Jan 27, 2019
1 parent 2c229cc commit a359055
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
6 changes: 6 additions & 0 deletions conf/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ packages:
# if package is not available locally, proxy requests to 'npmjs' registry
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
middlewares:
audit:
Expand Down
6 changes: 6 additions & 0 deletions conf/full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ packages:
# - [::1]:4873 # ipv6
# - 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.
#https:
# key: path/to/server.key
Expand Down
5 changes: 4 additions & 1 deletion src/lib/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ function startVerdaccio(config: any,
} else { // http
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);

callback(webServer, addr, pkgName, pkgVersion);
Expand Down

0 comments on commit a359055

Please sign in to comment.