An Interest In:
Web News this Week
- April 1, 2024
- March 31, 2024
- March 30, 2024
- March 29, 2024
- March 28, 2024
- March 27, 2024
- March 26, 2024
Run creat-react-app with HTTPS
Introduction
In current days we host websites on Vercel and Netlify and we are automatically assigned a generated SSL to provide with Secured connection(HTTPS), but in the development period we are unaware of the process to run it with HTTPS and we miss out on some testing which works only on HTTPS like google apis, etc.
Steps
- Configure creat-react-app project to handle https
- Generate SSL Certificates for localhost
- Add certificates to the project
- Trust certificate in browser
- Run the project secured
Configure creat-react-app project to handle https
Add a file .env
in the root directory of the project with the line
HTTPS=true
Generate SSL Certificates for localhost
Follow this article to generate a SSL certificate for localhost. and place the certificates in the root directory.
Generate an SSL Certificate With the Root Certificate for localhost
Pranjal Jain Jun 24 1 min read
after following this article you must have 8 new files in your directory, which are
rootCA.keyrootCA.pemrootCA.srlserver.crtserver.csrserver.csr.cnfserver.keyv3.ext
Add certificates to the project
in the .env
file add these two properties and there paths.
SSL_CRT_FILE=server.crtSSL_KEY_FILE=server.key
Here you will be using the server.crt
as your certificate file & server.key
as your key for certificate.
Trust certificate in browser
Follow this article to trust the certificate on your browser
Run the project secured
Hence you have HTTPS enabled for your project.
If you're stuck anywhere do leave a comment.
Follow me on Twitter at Twitter/pranjaljain0
Follow me on Github at github/pranjaljain0
Happy Hacking!
Original Link: https://dev.to/pranjaljain0/run-creat-react-app-with-https-4ep6
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To