ReactJS:IE11没有使用缓存数据发出新的HTTP请求

Vis*_*ati 5 internet-explorer http cache-control internet-explorer-11 reactjs

我在我的React应用程序IE11中遇到的问题是UI没有为每个新请求命中后端服务并从缓存数据返回响应.该应用程序在Chrome上正常运行.

在IE的情况下,服务以代码结束:304而不是200. PFB请求标头:

Accept  application/json,*/*
Request GET /services/v0/search/?uid=12900 HTTP/1.1
Content-Type    application/json
Cache-Control   no-cache
Run Code Online (Sandbox Code Playgroud)

PFB获取的响应头IE:

Response    HTTP/1.1 304 Not Modified
x-frame-options DENY
x-xss-protection    1; mode=block
x-content-type-options  nosniff
Run Code Online (Sandbox Code Playgroud)

任何线索,IE渲染这种行为背后的原因是什么?TIA

Dan*_*rei 20

您可以尝试添加"Pragma"标头:

headers: { Pragma: 'no-cache'}
Run Code Online (Sandbox Code Playgroud)

这里也提到:Axios只在内部自调用函数中调用一次(Internet Explorer)