Created by: alexbrazier
Closes: #4050 (closed) #3603 (closed) #3441 (closed) #1411 (closed)
This PR adds the option to provide a custom SSL certificate and key using the SSL_CRT_FILE
and SSL_KEY_FILE
env vars.
The webpack dev server already accepts certificates if you provide them, so this just reads the files and passes them in.
As an extra check so there is no confusion when an error occurs, it will verify the files exist and that they are valid before passing them into webpack.
You can pass in relative paths ../cert.crt
, cert.crt
etc, or full paths /Users/test/cert.crt
Testing
-
Tested using yarn start
andyarn create-react-app my-app
-
Tested with .env
file -
Tested with exported envs and inline envs -
Tested without HTTPS
flag - (same behaviour as before) -
Tested with HTTPS
flag and without new flags - (same behaviour as before) -
Tested with invalid path (see error below) -
Tested with invalid cert and key (see error below) -
Tested with valid custom cert and verified the dev server was using it