I am trying to enable static file caching but seems like no effect, at least in browser i could not find response header with name cache-control
This is my code
app.UseSpaStaticFiles(new StaticFileOptions
{
RequestPath = _settings.SpaRoute,
});
app.UseStaticFiles(new StaticFileOptions
{
OnPrepareResponse = ctx =>
{
// Cache static files for 30 days
ctx.Context.Response.Headers.Append("Cache-Control", "public,max-age=2592000");
ctx.Context.Response.Headers.Append("Expires", DateTime.UtcNow.AddDays(30).ToString("R", CultureInfo.InvariantCulture));
}
});
After building and running my app in local env i got the following response headers
As you can see no cache control header represented here, what am i doing wrong?

app.UseStaticFilesbefore what's shown here?Cache-Controlis enough by itself, no need forExpires: developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control, or its needless date arithmetic.OnPrepareResponseinside the options you pass intoUseSpaStaticFiles.