提问人:uwon 提问时间:11/7/2023 更新时间:11/7/2023 访问量:22
为什么即使我将其设置为不同的值,cache-control 标头仍设置为 private?
Why is cache-control header set to private even when I set it to a different value?
问:
我正在将 .NET Framework 4.8 与 MVC 一起使用,并尝试将 HttpResponseMessage 的 cacheControl 标头设置为 .我的方法如下public, max-age=300
[HttpGet]
public HttpResponseMessage Get()
{
var resp = new HtpResponseMessage
{
Content = new StringContent { ...};
};
resp.Headers.CacheControl = new CacheControlHeaderValue
{
Public = true,
MaxAge = TimeSpan.FromMinutes(5)
};
return resp
}
但是,响应的 cache-control 标头始终为 。为什么会这样?IIS 是否覆盖了它或其他东西?我只想对此操作方法应用此更改。Cache-Control: private
我也尝试过使用,但没有帮助。[OutputCache(Duration = 300)]
我对此进行了研究,并发现了相关问题,例如
但这些都没有真正解决我的问题。有人可以给我关于如何解决这个问题的建议吗?
答: 暂无答案
评论