'xhr request response should not pick from disk cache rails
Chrome does not hit server after clicking to button to fetch the data. It just fetches from cache disk. If I clear the cache then only request goes to the server but from next click same thing happens, It starts fetching data from the cache.
After button click, I am rendering the partial using remote: true.
Solution 1:[1]
Add the following header to your response :
Cache-Control: no-cache, no-store, must-revalidate
This will instruct the browser to turn off caching for this request endpoint.
Another workaround from the client side - Add a unique parameter to the endpoint. A way to generate unique parameter is to use the current timestamp. For example:
url += '?timestamp=' + Date.now()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
