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
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)