【发布时间】:2016-10-11 20:48:16
【问题描述】:
我有一个休息端点,它在 GET 调用中返回一个列表。我还有一个 POST 端点来添加新项目和一个 DELETE 来删除它们。这在 Firefox 和 Chrome 中有效,而 POST 和 DELETE 在 IE11 中有效。但是,IE11 中的 GET 仅适用于页面的初始加载。刷新返回缓存数据。我在 Angular 1 中看到过关于这种行为的帖子,但对于 Angular 2(候选版本 1)却没有。
【问题讨论】:
-
如果你的 GET api 没有指定 Any Cache Control header -> 如果状态为 200 OK 则表示响应是可缓存的。
-
另请参阅stackoverflow.com/questions/36500804/… 以了解客户端解决方法。
-
@Loc 我添加了 Cache-Control 值 no-store 和 no-cache ,但在 IE 中仍然得到相同的结果。
-
看起来我需要指定更多缓存头,我有
Cache-Control: not-store, no-cache需要添加Pragma: no-cache Expires: 0
标签: javascript angular typescript internet-explorer-11 http-caching