Skip to content

Commit c779350

Browse files
committed
Fix authentication with output cache
1 parent 8aa64fe commit c779350

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

BlazorOutputCaching/Program.cs

+3-5
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,9 @@
8282
app.UseAntiforgery();
8383
app.UseOutputCache();
8484

85-
86-
87-
// If I comment this line below, output cache no longer works..?
85+
// Required for OutputCache
8886
app.UseAuthentication();
87+
app.UseAuthorization();
8988

9089
app.MapRazorComponents<App>()
9190
.AddInteractiveServerRenderMode();
@@ -99,8 +98,7 @@
9998
{
10099
handlerBuilder.CacheOutput(policyBuilder =>
101100
{
102-
policyBuilder.Cache().Expire(TimeSpan.FromSeconds(15))
103-
.With(x => x.HttpContext.Request.Path.StartsWithSegments("/api"));
101+
policyBuilder.Cache().Expire(TimeSpan.FromSeconds(15));
104102
});
105103
});
106104
});

0 commit comments

Comments
 (0)