summaryrefslogtreecommitdiff
path: root/packages/integrations/node
diff options
context:
space:
mode:
Diffstat (limited to 'packages/integrations/node')
-rw-r--r--packages/integrations/node/README.md9
-rw-r--r--packages/integrations/node/src/standalone.ts3
2 files changed, 11 insertions, 1 deletions
diff --git a/packages/integrations/node/README.md b/packages/integrations/node/README.md
index be22cee8c..e0c8ea67f 100644
--- a/packages/integrations/node/README.md
+++ b/packages/integrations/node/README.md
@@ -109,6 +109,15 @@ node ./dist/server/entry.mjs
For standalone mode the server handles file servering in addition to the page and API routes.
+
+#### Custom host and port
+
+You can override the host and port the standalone server runs on by passing them as environment variables at runtime:
+
+```shell
+HOST=0.0.0.0 PORT=3000 node ./dist/server/entry.mjs
+```
+
#### HTTPS
By default the standalone server uses HTTP. This works well if you have a proxy server in front of it that does HTTPS. If you need the standalone server to run HTTPS itself you need to provide your SSL key and certificate.
diff --git a/packages/integrations/node/src/standalone.ts b/packages/integrations/node/src/standalone.ts
index 5ec2455ee..1a5ab399e 100644
--- a/packages/integrations/node/src/standalone.ts
+++ b/packages/integrations/node/src/standalone.ts
@@ -39,7 +39,8 @@ export default function startServer(app: NodeApp, options: Options) {
const { client } = resolvePaths(options);
const handler = middleware(app);
- const host = getResolvedHostForHttpServer(options.host);
+ // Allow to provide host value at runtime
+ const host = getResolvedHostForHttpServer(process.env.HOST !== undefined && process.env.HOST !== '' ? process.env.HOST : options.host);
const server = createServer(
{
client,