How to run Next app over HTTPS rather than HTTP with mkcert?

285 Views Asked by At

I have followed this article https://web.dev/how-to-use-local-https/ to do the steps required to run Next app over HTTPS.

In short these are the steps:

Brew install mkcert
mkcert -install
mkcert localhost
Then add certs to run script  "dev": "HTTPS=true SSL_CRT_FILE=localhost.pem SSL_KEY_FILE=localhost-key.pem next dev"

Completing these steps and running the app still serves over HTTP only.

npm run dev: `

[email protected] dev HTTPS=true SSL_CRT_FILE=localhost.pem SSL_KEY_FILE=localhost-key.pem next dev

  • ready started server on 0.0.0.0:3000, url: http://localhost:3000 `

How do I force it to run over HTTPS?

0

There are 0 best solutions below