Url requests get to add a random number as a parameter

Ajax requests URL with random number principle

for example:

$.ajax({
            type: "GET",
    url: "login.action?ran="+getRandomNum() 
});
Url in

is followed by a random number to deceive browsers or proxy servers.

my question is if the url you generate is

login.action?ran=39525

only login.action on the server side does not have this login.action?ran=39525
Why does the server use login.action as a reply and does not report an error?

May.10,2021

  • login.action is a backend route.
  • ran=39525 is a routing parameter.

the server only needs to match the corresponding route to process the request, and the parameters can be passed anything.


in a get request, a random number is added to the address query string parameter to avoid the browser caching the previous request for the result.
query string does not affect the access of uri, but may affect the result of the request depending on the business logic.

login.action?ran=39525
what is actually emitted by the browser is

GET /?ran=39525 HTTP/1.1

Host: login.action
Menu