I'm working on a react app where the app needs to open on https://localhost:3000 but its opening on http://localhost:3000.
I'm using windows OS and to make the app work I did the following
- generated the self signed certificate
- added it to the root level of the project
- my
package jsonhas
"start": "set HTTPS=true && set REACT_APP_GIT_VERSION=$(git rev-parse head) && react-scripts start",
"safeStart": "export HTTPS=true&&SSL_CRT_FILE=cert.pem&&SSL_KEY_FILE=key.pem react-scripts start",
when i try to run the app by using npm start or set HTTPS=true&&npm start the app is up and opening in the browser but served on http but not on https.
when i try to run the app using the npm safeStart or set HTTPS=true&&npm safeStart, i'm getting error at SSL saying its not configured.
I'm not sure if i'm missing something or i need to add some additional configs or so.
======================UPDATE====================
I made this work by doing the following,
- generated the ssl using https://www.npmjs.com/package/mkcert
- mapped the start command with reference to the key and file parameter
"start": "set HTTPS=true&&set SSL_CRT_FILE=C:/Windows/System32/cert.crt&&set SSL_KEY_FILE=C:/Windows/System32/cert.key&&react-scripts start",- now give npm start it should start the app on https://localhost:3000
https://localhost:3000"... why?SameSite=None;Securecookie support but that's not necessary when you can useSameSite=Laxonlocalhost