Skip to content
Permalink
Browse files

Add conditional protocol output to serving message (#1399)

This fixes the issue where https is configured but the "App serving at" URL in the console is still displayed with the http protocol
  • Loading branch information
SeinopSys committed Mar 25, 2020
1 parent de291b3 commit c03b971d9a89ab4607c65259f4f75d33321f3322
Showing with 17 additions and 1 deletion.
  1. +1 −0 CHANGELOG.md
  2. +14 −0 docs/config.md
  3. +2 −1 packages/react-static/src/static/webpack/runDevServer.js
@@ -12,6 +12,7 @@
- Update `react-static-plugin-jss` for react-jss v10+. ([#1367](https://github.com/react-static/react-static/pull/1367))
- Add inline script hashes to `DocumentProps`. These hashes can be used to construct a Content Security Policy in a meta tag without `unsafe-inline` scripts. ([#1373](https://github.com/react-static/react-static/pull/1373))
- Add environments variables (`REACT_STATIC_MESSAGE_SOCKET_PORT` and `REACT_STATIC_MESSAGE_SOCKET_HOST`) to change the xhr polling(socket.io) host and port (Only DevServer)
- Update protocol shown in the "App serving at" message to display `https` when configured ([#1399](https://github.com/react-static/react-static/pull/1399))

### Improved

@@ -258,6 +258,20 @@ export default {
}
```

This can also be used to enable HTTPS support for local development:

```javascript
// static.config.js
export default {
devServer: {
// Enable HTTPS and provide certificates
https: true,
key: fs.readFileSync('/path/to/localhost.key'),
cert: fs.readFileSync('/path/to/localhost.crt'),
},
}
```

### `renderToElement`

**Warning:** This option has been deprecated. Please use the [Node API hook - beforeRenderToElement](https://github.com/Vinnl/react-static/tree/patch-3/docs/plugins#beforerendertoelement-function) instead.
@@ -204,9 +204,10 @@ If this is a dynamic route, consider adding it to the prefetchExcludes list:
if (isSuccessful && !skipLog) {
if (first) {
timeEnd(chalk.green('[\u2713] Application Bundled'))
const protocol = state.config.devServer.https ? 'https' : 'http'
console.log(
`${chalk.green('[\u2713] App serving at')} ${chalk.blue(
`http://${state.config.devServer.host}:${state.config.devServer.port}`
`${protocol}://${state.config.devServer.host}:${state.config.devServer.port}`
)}`
)
} else {

0 comments on commit c03b971

Please sign in to comment.
You can’t perform that action at this time.