Skip to content

Commit dfff223

Browse files
authored
Set StaticFileOptions.OnPrepareResponse = CacheHeaderSettings.SetCacheHeaders for Blazor static files endpoint (#46085)
1 parent ce05ffd commit dfff223

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Components/Server/src/Builder/ComponentEndpointRouteBuilderExtensions.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using Microsoft.AspNetCore.Http.Connections;
77
using Microsoft.AspNetCore.Routing;
88
using Microsoft.AspNetCore.SignalR;
9+
using Microsoft.AspNetCore.StaticFiles;
910
using Microsoft.Extensions.FileProviders;
1011

1112
namespace Microsoft.AspNetCore.Builder;
@@ -96,7 +97,8 @@ private static IEndpointConventionBuilder GetBlazorEndpoint(IEndpointRouteBuilde
9697
{
9798
var options = new StaticFileOptions
9899
{
99-
FileProvider = new ManifestEmbeddedFileProvider(typeof(ComponentEndpointRouteBuilderExtensions).Assembly)
100+
FileProvider = new ManifestEmbeddedFileProvider(typeof(ComponentEndpointRouteBuilderExtensions).Assembly),
101+
OnPrepareResponse = CacheHeaderSettings.SetCacheHeaders
100102
};
101103

102104
var app = endpoints.CreateApplicationBuilder();

0 commit comments

Comments
 (0)