Closed guardrex closed 7 years ago
That shouldn't be happening. @mikaelm12 can you repro this?
I'll take a look
Took a quick look and I cannot reproduce the issue. Seems like the immutable cache headers are only added when the second static files middleware is serving the response. I'm using an older dotnet cli though but I don't think that should be a problem. @GuardRex is there anything else in your Configure
?
A full repro app would help
I'll try again. I see disabled code for ...
/*
app.Use(async (context, next) =>
{
context.Response.Headers.Add("Cache-Control", "max-age=36500000,immutable");
await next.Invoke();
});
*/
... as long as it was commented at the time I tested, it's fine. Let me try again and make sure that was the case.
My bad. I screwed the pooch :dog2: on this one. I was doing a lot of messing around that day with this, and I must have run the test app with that code enabled.
Sorry guys.
I was just taking a look at
OnPrepareResponse
trying setup aCache-Control
header with animmutable
directive only for a group of static assets in a special folder,ImmutableResourcesFolder
, and on a special path,/immutable
...... but all static files, including the ones in
wwwroot
, are getting theCache-Control
header set from theOnPrepareResponse
. For example ...I expected that only the assets requested on my
/immutable
path would get my specialCache-Control
header. Is this behavior a bug or by-design (and I'm setting it up incorrectly)?Note: There's an issue now to document
OnPrepareResponse
at https://github.com/aspnet/Docs/issues/2625.My test app for this is a
netcoreapp2.0
/1.2.0-*
nightly packages app. Environment ...