Unable to set a default cache policy for requests without ResponseCache attribute?
Plasma opened this issue · 4 comments
Hello,
By default it seems .NET Core omits any Cache-Control headers.
However, I want an explicit Cache-Control: private by default, unless overridden.
Is there a way to do this? It does not look like it.
Thank you
Are you using MVC? MVC has attributes where you can set these.
@Plasma There's also a middleware-based HTTP pipeline-based approach we show in the response caching doc using app.Run()
[and use app.Map()
if you want to apply to a subset of path segments]:
May be worth highlighting proxies like CloudFlare.com will insert a public cache control header if it sees no cache header and "Cache everything" is turned on, so ideally private cache control was default out of the box.
This issue was moved to dotnet/aspnetcore#2608