From e14fde3d3ef7e3d2c0d761ecddd2b39c65dd8040 Mon Sep 17 00:00:00 2001 From: Roman O Date: Tue, 22 Feb 2022 16:35:22 +0300 Subject: [PATCH 1/2] Update env.js Default host is 0.0.0.0 by doc --- packages/razzle/config/env.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/razzle/config/env.js b/packages/razzle/config/env.js index 4dc3b682e..372b761be 100644 --- a/packages/razzle/config/env.js +++ b/packages/razzle/config/env.js @@ -51,7 +51,7 @@ function getClientEnvironment(target, is_dev, options, paths) { NODE_ENV: process.env.NODE_ENV || 'development', PORT: process.env.PORT || options.port || 3000, VERBOSE: !!process.env.VERBOSE, - HOST: process.env.HOST || options.host || 'localhost', + HOST: process.env.HOST || options.host || '0.0.0.0', RAZZLE_ASSETS_MANIFEST: paths.appAssetsManifest, BUILD_TARGET: target === 'web' ? 'client' : 'server', // only for production builds. Useful if you need to serve from a CDN From 78949179b020ebf9f8e6dd2893381f0b5dda0c13 Mon Sep 17 00:00:00 2001 From: Roman Date: Tue, 1 Mar 2022 11:56:19 +0300 Subject: [PATCH 2/2] Change default host in the docs --- packages/create-razzle-app/templates/default/README.md | 2 +- packages/razzle/config/env.js | 2 +- website/pages/docs/environment-variables.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/create-razzle-app/templates/default/README.md b/packages/create-razzle-app/templates/default/README.md index e54a6b0eb..6c6124694 100644 --- a/packages/create-razzle-app/templates/default/README.md +++ b/packages/create-razzle-app/templates/default/README.md @@ -155,7 +155,7 @@ Last but not least, if you find yourself needing a more customized setup, Razzle * `process.env.REACT_BUNDLE_PATH`: Relative path to where React will be bundled during development. Unless you are modifying the output path of your webpack config, you can safely ignore this. This path is used by `react-error-overlay` and webpack to power up the fancy runtime error iframe. For example, if you are using common chunks and an extra entry to create a vendor bundle with stuff like react, react-dom, react-router, etc. called `vendor.js`, and you've changed webpack's output to `[name].js` in development, you'd want to set this environment variable to `/static/js/vendor.js`. If you do not make this change, nothing bad will happen, you will simply not get the cool error overlay when there are runtime errors. You'll just see them in the console. Note: This does not impact production bundling. * `process.env.VERBOSE`: default is false, setting this to true will not clear the console when you make edits in development (useful for debugging). * `process.env.PORT`: The `BUILD_TARGET=server` build listens on this port for all NODE_ENVs. default is `3000` -* `process.env.HOST`: The IP address that the server will bind to. default is `0.0.0.0`, for INADDR_ANY +* `process.env.HOST`: The IP address that the server will bind to. default is `localhost`, for INADDR_ANY * `process.env.NODE_ENV`: `'development'` or `'production'` * `process.env.BUILD_TARGET`: either `'client'` or `'server'` * `process.env.PUBLIC_PATH`: Only in used in `razzle build`. You can alter the `webpack.config.output.publicPath` of the client assets (bundle, css, and images). This is useful if you plan to serve your assets from a CDN. Make sure to _include_ a trailing slash (e.g. `PUBLIC_PATH=https://cdn.example.com/`). If you are using React and altering the public path, make sure to also [include the `crossorigin` attribute](https://reactjs.org/docs/installation.html#using-a-cdn) on your `