ReactJS: IE11 not making new HTTP request, using cached data

JS dev picture JS dev · Aug 28, 2017 · Viewed 15.4k times · Source

I am facing issues in my React application on IE11 where the UI is not hitting backend services for every new request and returning the response from cache data. The application works fine on Chrome.

In case of IE the services end with code : 304 instead of 200. PFB the request headers:

Accept  application/json,*/*
Request GET /services/v0/search/?uid=12900 HTTP/1.1
Content-Type    application/json
Cache-Control   no-cache

PFB the response headers obtained on IE:

Response    HTTP/1.1 304 Not Modified
x-frame-options DENY
x-xss-protection    1; mode=block
x-content-type-options  nosniff

Any clue, what could be the reason behind IE rendering such behaviour? TIA

Answer

Daniel Andrei picture Daniel Andrei · Aug 28, 2017

You could try adding the "Pragma" header:

headers: { Pragma: 'no-cache'}

also mentioned here : Axios only called once inside self-invoking function (Internet Explorer)