85

I have a PHP server running on Apache, I get lots of request looks like this,

10.1.1.211 - - [02/Sep/2010:16:14:31 -0400] "GET /request?_=1283458471913&action=get_list HTTP/1.1" 200 547 0 "http://www.example.com/request" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 (.NET CLR 3.5.30729)" 28632 15602

The _ parameter is mysteriously added to the request. I am trying to find out who is doing that.

There is a NetScaler running in front of Apache.

3
  • why is the IP 10.1.1.211 that's a local IP provided by a router/modem right?
    – RobertPitt
    Sep 10, 2010 at 19:38
  • @RobertPitt probably the IP of the NetScaler upstream?
    – jfrobishow
    Sep 10, 2010 at 19:57
  • oki just wondered, never used NetScaler
    – RobertPitt
    Sep 10, 2010 at 19:59

5 Answers 5

118

jQuery adds a parameter like that to get around IE's caching.

edit: it only adds it for get requests, and only if the option cache is false:

cache: false
6
  • I do use jQuery but it doesn't appear in every request.
    – ZZ Coder
    Sep 10, 2010 at 19:51
  • Are you using some ajax call where you specify the nocache attribute? It will only be added then and only if it's a GET request. See my code below from jQuery if(s.cache === false && type == "GET")
    – jfrobishow
    Sep 10, 2010 at 19:54
  • I only have this one AJAX call on my page and I do set the nocache attribute. However, some requests don't have the parameter.
    – ZZ Coder
    Sep 10, 2010 at 21:41
  • 3
    Note that the option cache defaults to false if the data type is 'script' or 'jsonp'. api.jquery.com/jQuery.ajax Jun 4, 2013 at 9:56
  • 13
    Yeah, it just ruined my request to a bank's API which doesn't accept any extra. It was coming from nowhere like "Surprise MotherF#$&@ !" -_- Apr 14, 2014 at 8:41
10

It could be the JQuery CacheBuster parameter.


Resources :

4

Probably it's a dummy parameter added by the reverse proxy to force non-cached content to be served.

4

1283458471913 is a unix timestamp in ms, probably a bot/proxy making sure that they get a fresh page and not a cached version.

Could also be jQuery which would cause this for AJAX request of you have the nocache attribute set to true.

if ( s.cache === false && type == "GET" ) {
    var ts = now();
    // try replacing _= if it is there

    var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2″);
    // if nothing was replaced, add timestamp to the end

    s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : "");
}
2

Ajax tools, like jQuery, is able to ask the browser not to cache the requested result, so every request from the loaded web page will travel to web server and get the newest response.

In order to achieve that, set cache flag as false, then an additional query parameter, like _=1234567890, is appended into the request URL. Of course the number is always changing, so the browser thinks it as a brand-new request and won't provide any cached things.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.