I'm trying to add certificate with let's encrytp to my Blazor Server App that is hosted in a linux azure web app.
My issue is, that the path /.well-known/acme-challenge redirect to my Index page so when I try to create my certificate, I have an error.
Do you know how to achieve this with blazor ?
EDIT :
After following the link from @Yan, the folder still not accessible ( in dev & production)
Here the configuration :
public static class AcmeChallengeResponderExtensions
{
private const string WellKnownFolder = @".well-known";
private const string WellKnownRequestPath = @"/.well-known";
private const string AcmeChallenceFolder = @"acme-challenge";
public static IApplicationBuilder UseAcmeChallengeResponder(this IApplicationBuilder app)
{
var rootFolderPath = Directory.GetCurrentDirectory();
var root = new DirectoryInfo(rootFolderPath);
if (!root.Exists)
throw new ArgumentException("The provided folder does not exist");
var wellKnownFolder = root.CreateSubdirectory(WellKnownFolder);
var acmeChallenge = root.CreateSubdirectory(Path.Combine(WellKnownFolder, AcmeChallenceFolder));
app.UseStaticFiles(new StaticFileOptions
{
RequestPath = new PathString(WellKnownRequestPath),
FileProvider = new PhysicalFileProvider(Path.Combine(rootFolderPath, WellKnownFolder)),
ServeUnknownFileTypes = true,
});
return app;
}
}