I need to run "serve -s build" with https in reactjs application.
Try to run HTTPS with Npm and it is worked fine but when run production build using"serve -s build" the production run with HTTP not HTTPS.
serve -s build
You must pass ssl information and the switch operate automatically.
openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem
# Fill all prompted demands, "127.0.0.1" as "Common name" is OK for development environment
serve -s build --ssl-cert cert.pem --ssl-key key.pem
Try using serve-https instead.
And if you are testing it in localhost
in the Google Chrome you can enalble Allow invalid certificates for resources loaded from localhost.
in chrome://flags/
UPDATE
serve-https seems unmaintened and its homepage git.daplie.com/Daplie/serve-https is not accessible at the time this post is written. – psychoslave