I am trying to host a react app I created and tested locally using the facebook boilerplate.
The client app interacts with an API I made using node.js, and with
Your server that serves files from that port needs to be configured to use your SSL cert. I'm guessing you are using webpack-dev-server on that port (that's what npm start
does in create-react-app), and maybe a different server (apache, nginx, etc) on port 80?
You can either serve your compiled files using your already configured server, or configure webpack-dev-server to use your SSL cert.
To do this, you can use webpack-dev-server's --cert
option. See https://webpack.github.io/docs/webpack-dev-server.html
NOTE: you need an extra
--
to pass arguments through npm run to the underlying command, e.g.npm start -- --cert ...
.
If you want to do this using npm start, which calls a custom start script, you'll have to edit that start script. You may need to use the eject
command first, which dumps all the config code into your repo so you can change it.
Here is the source code of the start script: https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/scripts/start.js#L230
I should also note that webpack-dev-server isn't intended to be used in a production environment.
Have fun!