Skip to content

Commit

Permalink
fix(node-server): default production host to 0.0.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Apr 20, 2022
1 parent c41863e commit b7c7193
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/deploy/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ You can now deploy fully standalone `.output` directory to the hosting of your c
You can customize server behavior using following environment variables:

- `NITRO_PORT` or `PORT` (defaults to `3000`)
- `NITRO_HOST` or `HOST` (defaults to `'localhost'`)
- `NITRO_HOST` or `HOST` (defaults to `'0.0.0.0'`)
- `NITRO_SSL_CERT` and `NITRO_SSL_KEY` - if both are present, this will launch the server in HTTPS mode. In the vast majority of cases, this should not be used other than for testing, and the Nitro server should be run behind a reverse proxy like nginx or Cloudflare which terminates SSL.


Expand Down
2 changes: 1 addition & 1 deletion src/runtime/entries/node-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const key = process.env.NITRO_SSL_KEY
const server = cert && key ? new HttpsServer({ key, cert }, nitroApp.h3App.nodeHandler) : new HttpServer(nitroApp.h3App.nodeHandler)

const port = (destr(process.env.NITRO_PORT || process.env.PORT) || 3000) as number
const hostname = process.env.NITRO_HOST || process.env.HOST || 'localhost'
const hostname = process.env.NITRO_HOST || process.env.HOST || '0.0.0.0'

// @ts-ignore
server.listen(port, hostname, (err) => {
Expand Down

0 comments on commit b7c7193

Please sign in to comment.