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!
CodePudding user response:
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.
CodePudding user response:
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.