0

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

2 Answers 2

1

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

See also

Sign up to request clarification or add additional context in comments.

Comments

0

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

1 Comment

serve-https seems unmaintened and its homepage git.daplie.com/Daplie/serve-https is not accessible at the time this post is written.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.