I was wondering if anyone knows how to use https on dev for the 'create-react-app' environment. I can't see anything about that in the README or quick googling. I just want either the https://localhost:3000 to work, or else https://localhost:3001.
To change the default port for a create-react-app project, update the start command in your package. json file to specify the port, e.g. "PORT=3456 react-scripts start" on macOS and Linux and "set PORT=3456 && react-scripts start" on Windows.
Set HTTPS=true
before you run the start command.
Documentation
The implementation uses the HTTPS Environment Variable to determine which protocol to use when starting the server.
You can edit your package.json scripts section to read:
"scripts": { "start": "set HTTPS=true&&react-scripts start", ... }
or just run set HTTPS=true&&npm start
Just a sidenote, for me, making this change breaks hot reloading for some reason....
-- Note: OS === Windows 10 64-Bit
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With