next.jshttps

How do I launch nextjs app with https in production?


I am writing a nextjs application. I need to launch it with https because the crypto module requires a secureContext. I have nginx setup with https to proxy requests to the nextjs app as https.

I have tried adding --experimental-https in my packages.json to the next start, but this gives the error:

error: unknown option '--experimental-https'

This flag only seems to work in dev mode.


Solution

  • As long as your webserver handles https there is no need to make any next js modification to support it. As the error states, there is no --experimental-https option for next start