Advertisement
thebossnt

asp.net core override Cache-Control header

Sep 7th, 2019
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.36 KB | None | 0 0
  1. app.UseStaticFiles(new StaticFileOptions()
  2. {
  3.     ServeUnknownFileTypes = true,
  4.     OnPrepareResponse = context =>
  5.     {
  6.         context.Context.Response.Headers["test"] = "ok"; // this work
  7.         context.Context.Response.Headers[HeaderNames.CacheControl] = "public, max-age=1296000, must-revalidate"; // doesn't work => always respond "no-store, must-revalidate, no-cache"
  8.     },
  9.    
  10. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement