-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
area-middlewareIncludes: URL rewrite, redirect, response cache/compression, session, and other general middlewaresIncludes: URL rewrite, redirect, response cache/compression, session, and other general middlewares
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
// Serve some files unauthenticated
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(
Path.Combine(app.Environment.WebRootPath, "css")),
RequestPath = "/css"
});
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseAntiforgery();
app.MapStaticAssets();
How do you change cache-control header with MapStaticAssets so that files are actually cached by memory cache by browser?
Currently, file is still hitting server after initial load and although it returns 304, isn't the goal to return from memory cache and have the fingerprint change if changed on publish?
Could the documentation clear this up a little? It says Cache-Control is default set to no-cache but doesn't explain how to set the caching strategy in combination with MapStaticAssets
Expected Behavior
Clear documentation on how to handle caching with MapStaticFiles
Its too confusing with WithStaticAssets, MapStaticFiles, UseStaticFiles middleware, etc...
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
9.0.2
Anything else?
No response
Metadata
Metadata
Assignees
Labels
area-middlewareIncludes: URL rewrite, redirect, response cache/compression, session, and other general middlewaresIncludes: URL rewrite, redirect, response cache/compression, session, and other general middlewares