How does adding a random number to the end of an AJAX server request prevent caching?

How exactly does adding a random number to the end of an AJAX server call prevent caching of the database server or browser (not quite sure which one is intended)? why does it work?

+2
source share
3 answers

It is designed to prevent client side caching (or reverse proxy).

Since the cache will be bound to the exact request by adding a random element to the request, the exact request URL will never be displayed twice; therefore, it will not be used more than once, and the intelligent cache will not worry about having never been seen more than once, at least not for long.

+4
source

This will prevent your browser (and a reasonable amount, web proxy) from caching requests. Typically, a query parameter - for example? Rand2024 = tells the browser / proxy to send the request forward with a parameter indicating that your application is behaving differently. This is why such queries are useful for enumerating caches.

+2
source

Your browser caches the web page using the exact text of the URL, so adding a random number parameter ensures that the URL is different every time - thus, no real caching. Your browser does not know that the server (hopefully) ignores this parameter.

0
source

Source: https://habr.com/ru/post/1441857/


All Articles