How to setup SSL for localhost or dev environment?

System Information
  • Strapi Version: v3.5.4
  • Operating System: Ubuntu Focal Fossa
  • Database: MongoDB Atlas
  • Node Version: v14.16.0
  • Yarn Version: v1.22.5

Hello, recently I read how to use HTTPS for Local Development for React, Angular, and Node.
The tutorial uses mkcert and is able to setup HTTPS for Node as well. However, I am confused to apply that in Strapi as I do not know which file acts as “index.js” or “server.js” in Strapi. Any ideas will be appreciated, thanks!

Short answer is you don’t within Strapi itself, you would need to use a proxy application like Caddy, HAProxy, or nginx locally. We have various sample configs on our documentation:

We don’t support native SSL on Strapi itself due to how node functions, when a production cert has to be renewed, a new cert is issued which would require Strapi to restart to load it.

1 Like

dear @DMehaffy, when we want to Deploy Strapi with Dokku on e.g. Hetzner Server.

How can we configure so that dokku app (strapi) works with the domain and SSL?

Thank you

1 Like

I.e. I allways get Dokku container error and I thinkn the problem is with SSL.

I use Letsencrypt dokku plugin like in that tutorial.

I am not familiar with Dokku or any self-hosted PaaS options.

I"m a bit late to the party, but for anyone looking for the samething. Ngrok is your guy - Using ngrok to get a public HTTPS address for a local server already serving HTTPS (for free) – Cameron Dwyer