DEV Community

Siv Deploys
Siv Deploys

Posted on

2

Run react app in SSL

Steps to run react code in SSL
1) Get cert and key from a certificate authority
2) Copy the cert file to certs folder
3) Copy the key file to certs/keys folder
4) Add/modify the start script in package.json
Windows:
"scripts": {
"start": "set HTTPS=true&&set SSL_CRT_FILE=./certs/cert.pem&&set SSL_KEY_FILE=./certs/keys/key.pem&&react-scripts start",
},

Linux:
"scripts": {
"start": "export HTTPS=true&&SSL_CRT_FILE=./certs/cert.pem&&SSL_KEY_FILE=./certs/keys/key.pem react-scripts start",
},

5) Run the app (npm start) and hit https://servername:port where servername name of the server mentioned in the cert and port port number for the app

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay