diff --git a/Program.cs b/Program.cs index 02c138a..b480d28 100644 --- a/Program.cs +++ b/Program.cs @@ -23,7 +23,27 @@ if (!app.Environment.IsDevelopment()) app.UseHttpsRedirection(); app.UseCors(); -app.UseStaticFiles(); +app.UseStaticFiles(new StaticFileOptions +{ + ServeUnknownFileTypes = true, // Allows serving unknown file types + DefaultContentType = "application/octet-stream", // Default content type + OnPrepareResponse = ctx => + { + var path = ctx.File.PhysicalPath.ToLowerInvariant(); + if (path.EndsWith(".woff")) + { + ctx.Context.Response.ContentType = "font/woff"; + } + else if (path.EndsWith(".woff2")) + { + ctx.Context.Response.ContentType = "font/woff2"; + } + else if (path.EndsWith(".ico")) + { + ctx.Context.Response.ContentType = "image/x-icon"; + } + } +}); app.UseRouting();