When running a fetch request to a node express server, it returns old data (that was previously returned from the same endpoint). This happens sporadically, but more often than not.
I have disabled the Cache-Control
in the fetch header, but that did not work.
The Express server is running on a Windows Server, through PM2, which is accessed through a Reverse Proxy in IIS (pointing to the local pm2 host, on port 5000) with an SSL certificate attached to the domain.
This does NOT happen when the backend is hosted through the localhost on my machine (NOT the server).
My fetch request is as follows:
fetch(URL, {
headers: {'Cache-Control':'no-cache'}
}).then(r=>r.json())
.then(json=>...)
Does anyone have any idea on what's causing this? Is there a preference in Windows Server or IIS that I need to change? Or is there something in PM2?