From ae5f70a7391c462535190979eabe9402345c2625 Mon Sep 17 00:00:00 2001 From: sbwalker Date: Wed, 29 Jan 2025 12:27:42 -0500 Subject: [PATCH] remove Environment.IsDevelopment logic --- Oqtane.Server/Startup.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Oqtane.Server/Startup.cs b/Oqtane.Server/Startup.cs index eeee71cd..8ab42dd8 100644 --- a/Oqtane.Server/Startup.cs +++ b/Oqtane.Server/Startup.cs @@ -203,17 +203,15 @@ namespace Oqtane app.UseHttpsRedirection(); app.UseStaticFiles(new StaticFileOptions { - ServeUnknownFileTypes = true, OnPrepareResponse = (ctx) => { - if (!env.IsDevelopment()) + // static asset caching + var cachecontrol = Configuration.GetSection("CacheControl"); + if (!string.IsNullOrEmpty(cachecontrol.Value)) { - var cachecontrol = Configuration.GetSection("CacheControl"); - if (!string.IsNullOrEmpty(cachecontrol.Value)) - { - ctx.Context.Response.Headers.Append(HeaderNames.CacheControl, cachecontrol.Value); - } + ctx.Context.Response.Headers.Append(HeaderNames.CacheControl, cachecontrol.Value); } + // CORS headers for .NET MAUI clients var policy = corsPolicyProvider.GetPolicyAsync(ctx.Context, Constants.MauiCorsPolicy) .ConfigureAwait(false).GetAwaiter().GetResult(); corsService.ApplyResult(corsService.EvaluatePolicy(ctx.Context, policy), ctx.Context.Response);