如何使用ServiceStack设置Cache-Control?

问题描述 投票:1回答:1

我想关闭HTTP响应的缓存。这是我的代码:

public class CacheControlHeaderAttribute : ResponseFilterAttribute { public override void Execute(IRequest req, IResponse res, object responseDto) { res.AddHeader(HttpHeaders.CacheControl, "no-store,must-revalidate,no-cache,max-age=0"); res.AddHeader("X-Test", "Hello from ServiceStack!"); } }

问题是它不起作用。 Cache-Control已设置为private。我该如何解决?

servicestack cache-control
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.