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!
            Asked
            
        
        
            Active
            
        
            Viewed 1,587 times
        
    2 Answers
0
            
            
        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.
 
    
    
        Julian
        
- 105
- 1
- 5
0
            
            
        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.
 
    
    
        clamchoda
        
- 4,411
- 2
- 36
- 74
