【发布时间】:2020-10-03 14:13:35
【问题描述】:
谁能解释一下 IE11 的行为?
据我所知,所有支持 Http 1.1 的浏览器(除了一些有 bug 的版本)都支持 Cache-Control 标头。
我的后端只有Access-Control-Request-Headers 和Cache-Control 和If-Modified-Since,所以我不能使用Expires 或Pragma。
就我而言,IE11 的行为很奇怪。
Cache-Control 的任何指令在 IE11 中根本不适合我。 IE11 只是缓存所有带有此类标头的请求:
Cache-Control: no-cacheCache-Control: no-store, no-cacheCache-Control: no-cache, max-age=0Cache-Control: no-store, no-cache, max-age=0, must-revalidate- 以及任何其他指令组合。
有趣的是,只需添加 If-Modified-Since: 0 即可解决我的问题。
为什么 IE11(我在许多 PC 上尝试过)完全忽略 Cache-Control 而只是缓存所有数据?
请求的标头:
Accept: */*
Accept-Encoding: gzip, deflate
Access-Control-Request-Headers: cache-control, expires, accept-language, x-website-token, authorization, x-website-config, accept
Access-Control-Request-Method: GET
Cache-Control: no-cache
Content-Length: 0
Host: ----
Origin: ----
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko
响应的标题:
access-control-allow-credentials: false
access-control-allow-headers: DNT, User-Agent, X-Website-Token, X-Website-Config, X-Website-Dgp, X-Integration-Id, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type,Range, Accept, Accept-Language, Authorization, DNT
access-control-allow-methods: GET, POST, PUT, PATCH, DELETE, OPTIONS
access-control-allow-origin: *
access-control-expose-headers: X-Pagination-Total-Count, X-Pagination-Page-Count, X-Pagination-Current-Page, X-Pagination-Per-Page
access-control-max-age: 3600
content-type: application/json; charset=UTF-8
date: Sat, 13 Jun 2020 23:01:32 GMT
server: nginx/1.16.1
set-cookie: x-last-referrer=;Domain=-----;Path=/;
x-release-version: 1
【问题讨论】:
标签: internet-explorer caching internet-explorer-11 browser-cache cache-control