Skip to content

Commit

Permalink
Fix missing .well-known files
Browse files Browse the repository at this point in the history
Workaround `.well-known` files not being copied into the published container image by renaming the folder and manually mapping the requests.
  • Loading branch information
martincostello committed Apr 28, 2024
1 parent 93ac0eb commit 1d0ac0d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Website/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,19 @@ static string GetVersion<T>()
=> typeof(T).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()!.InformationalVersion;
});

// HACK Workaround for https://github.com/dotnet/sdk/issues/40511
app.MapGet(".well-known/{fileName}", (string fileName, IWebHostEnvironment environment) =>
{
var file = environment.WebRootFileProvider.GetFileInfo(Path.Combine("well-known", fileName));
if (file.Exists && file.PhysicalPath is { Length: > 0 })
{
return Results.File(file.PhysicalPath, contentType: "application/json");
}
return Results.NotFound();
});

app.UseCookiePolicy(new()
{
HttpOnly = HttpOnlyPolicy.Always,
Expand Down

0 comments on commit 1d0ac0d

Please sign in to comment.