skip to Main Content

I created an app with Blazor (Blazor – API – DB). It’s a personnal app that I will not sell.
I only use it once a year on a local network with Docker (Nginx).
I would like to secure it with HTTPS. How can I do that without buying a certificate? Thanks!

2

Answers


  1. I don’t think any certificate authority will give you a certificate to a localhost domain, but you can generate a self-signed certificate and use that:

    https://stackoverflow.com/a/10176685/8792473

    Your browser might complain that it’s not secure since you’re not a trusted CA, but you can safely ignore that for localhost purposes.

    Login or Signup to reply.
  2. Generate your pfx then tell Kestrel to use it.

    builder.WebHost.ConfigureKestrel(opt =>
    {
        opt.ListenAnyIP(9000);
        opt.ListenAnyIP(9001, listOpt =>
        {
            listOpt.UseHttps("Path to pfx", "Password to pfx");
        });
    });
    

    Install CA certificates on trusted devices as described in my other answer I linked to. You shouldn’t receive any warnings or need to accept any exceptions.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search