diff --git a/src/BlazorUI/Demo/Bit.BlazorUI.Demo.Server/Startup/Middlewares.cs b/src/BlazorUI/Demo/Bit.BlazorUI.Demo.Server/Startup/Middlewares.cs index 6c36affd5e..6e9e18e251 100644 --- a/src/BlazorUI/Demo/Bit.BlazorUI.Demo.Server/Startup/Middlewares.cs +++ b/src/BlazorUI/Demo/Bit.BlazorUI.Demo.Server/Startup/Middlewares.cs @@ -11,7 +11,7 @@ namespace Bit.BlazorUI.Demo.Server.Startup; public class Middlewares { - public static void Use(WebApplication app, IHostEnvironment env, IConfiguration configuration) + public static void Use(WebApplication app, IWebHostEnvironment env, IConfiguration configuration) { app.UseForwardedHeaders(); @@ -31,7 +31,8 @@ public static void Use(WebApplication app, IHostEnvironment env, IConfiguration { app.Use(async (context, next) => { - if (context.Request.Query.Any(q => string.Equals(q.Key, "assetVer", StringComparison.InvariantCultureIgnoreCase))) + if (context.Request.Query.Any(q => string.Equals(q.Key, "v", StringComparison.InvariantCultureIgnoreCase)) && + env.WebRootFileProvider.GetFileInfo(context.Request.Path).Exists) { context.Response.OnStarting(async () => { diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/Program.Middlewares.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/Program.Middlewares.cs index e1243eea86..d74f3ee5d5 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/Program.Middlewares.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/Program.Middlewares.cs @@ -59,7 +59,8 @@ private static void ConfiureMiddlewares(this WebApplication app) { app.Use(async (context, next) => { - if (context.Request.Query.Any(q => string.Equals(q.Key, "assetVer", StringComparison.InvariantCultureIgnoreCase))) + if (context.Request.Query.Any(q => string.Equals(q.Key, "v", StringComparison.InvariantCultureIgnoreCase)) && + env.WebRootFileProvider.GetFileInfo(context.Request.Path).Exists) { context.Response.OnStarting(async () => { diff --git a/src/Websites/Careers/src/Bit.Websites.Careers.Server/Startup/Middlewares.cs b/src/Websites/Careers/src/Bit.Websites.Careers.Server/Startup/Middlewares.cs index e9065c2232..a7b22292db 100644 --- a/src/Websites/Careers/src/Bit.Websites.Careers.Server/Startup/Middlewares.cs +++ b/src/Websites/Careers/src/Bit.Websites.Careers.Server/Startup/Middlewares.cs @@ -12,7 +12,7 @@ namespace Bit.Websites.Careers.Server.Startup; public class Middlewares { - public static void Use(WebApplication app, IHostEnvironment env, IConfiguration configuration) + public static void Use(WebApplication app, IWebHostEnvironment env, IConfiguration configuration) { app.UseForwardedHeaders(); @@ -32,7 +32,8 @@ public static void Use(WebApplication app, IHostEnvironment env, IConfiguration { app.Use(async (context, next) => { - if (context.Request.Query.Any(q => string.Equals(q.Key, "assetVer", StringComparison.InvariantCultureIgnoreCase))) + if (context.Request.Query.Any(q => string.Equals(q.Key, "v", StringComparison.InvariantCultureIgnoreCase)) && + env.WebRootFileProvider.GetFileInfo(context.Request.Path).Exists) { context.Response.OnStarting(async () => { diff --git a/src/Websites/Platform/src/Bit.Websites.Platform.Server/Startup/Middlewares.cs b/src/Websites/Platform/src/Bit.Websites.Platform.Server/Startup/Middlewares.cs index 29092b3aa8..e9c30e38dd 100644 --- a/src/Websites/Platform/src/Bit.Websites.Platform.Server/Startup/Middlewares.cs +++ b/src/Websites/Platform/src/Bit.Websites.Platform.Server/Startup/Middlewares.cs @@ -10,7 +10,7 @@ namespace Bit.Websites.Platform.Server.Startup; public class Middlewares { - public static void Use(WebApplication app, IHostEnvironment env, IConfiguration configuration) + public static void Use(WebApplication app, IWebHostEnvironment env, IConfiguration configuration) { app.UseForwardedHeaders(); @@ -30,7 +30,8 @@ public static void Use(WebApplication app, IHostEnvironment env, IConfiguration { app.Use(async (context, next) => { - if (context.Request.Query.Any(q => string.Equals(q.Key, "assetVer", StringComparison.InvariantCultureIgnoreCase))) + if (context.Request.Query.Any(q => string.Equals(q.Key, "v", StringComparison.InvariantCultureIgnoreCase)) && + env.WebRootFileProvider.GetFileInfo(context.Request.Path).Exists) { context.Response.OnStarting(async () => { diff --git a/src/Websites/Sales/src/Bit.Websites.Sales.Server/Startup/Middlewares.cs b/src/Websites/Sales/src/Bit.Websites.Sales.Server/Startup/Middlewares.cs index 4cb77e96e3..435863c48a 100644 --- a/src/Websites/Sales/src/Bit.Websites.Sales.Server/Startup/Middlewares.cs +++ b/src/Websites/Sales/src/Bit.Websites.Sales.Server/Startup/Middlewares.cs @@ -12,7 +12,7 @@ namespace Bit.Websites.Sales.Server.Startup; public class Middlewares { - public static void Use(WebApplication app, IHostEnvironment env, IConfiguration configuration) + public static void Use(WebApplication app, IWebHostEnvironment env, IConfiguration configuration) { app.UseForwardedHeaders(); @@ -32,7 +32,8 @@ public static void Use(WebApplication app, IHostEnvironment env, IConfiguration { app.Use(async (context, next) => { - if (context.Request.Query.Any(q => string.Equals(q.Key, "assetVer", StringComparison.InvariantCultureIgnoreCase))) + if (context.Request.Query.Any(q => string.Equals(q.Key, "v", StringComparison.InvariantCultureIgnoreCase)) && + env.WebRootFileProvider.GetFileInfo(context.Request.Path).Exists) { context.Response.OnStarting(async () => {