Skip to main content
4 of 4
replaced http://stackapps.com/ with https://stackapps.com/

API ignores jsonp callback after initial request - erroneous caching?

This bug is still prevalent, appears to be cache related. Two identical requests return different data: first request respects jsonp query parameter, all subsequent requests ignore it until (I presume) the server-side cache expires. This is the case for revisions 1.0 and 1.1.

These two requests in chronological order:

GET http://api.serverfault.com/1.1/users/6246/top-answer-tags?key=P5K7zSMTYk-Has4Spe848g&jsonp=jsonp12980289083367&_=12980289093903232

200 OK

633 B
 
538ms

Cache-Control   private
Content-Type    application/javascript; charset=utf-8
Content-Encoding    gzip
X-AspNetMvc-Version 3.0
X-RateLimit-Max 10000
X-RateLimit-Current 9999
X-AspNet-Version    4.0.30319
Date    Fri, 18 Feb 2011 13:27:09 GMT
Content-Length  633
X-Antivirus avast! 4
X-Antivirus-Status  Clean
Request Headersview source
Host    api.serverfault.com
User-Agent  Mozilla/5.0 (Windows; U; ...
Accept  text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8,application/json
Accept-Language en-gb,en;q=0.5
Accept-Encoding gzip,deflate
Accept-Charset  ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive  115
Connection  keep-alive
Cookie  __utma=81883924.1801528020.1274785032.1286198914.1286791946.7; __utmz=81883924.1286791946.7.5.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=nginx%20does%20not%20pass%20request%20to%20apache; __qca=P0-1856570125-1274785031953
x-insight   activate
Pragma  no-cache
Cache-Control   no-cache

jsonp12980289083367({
  "top_tags": [
    {
      "tag_name": "linux",
      "question_score": 2,
      "question_count": 1,
      "answer_score": 37,
      "answer_count": 19
    },
    {
      "tag_name": "apache",
      "question_score": 4,
      "question_count": 1,
      "answer_score": 35,
      "answer_count": 21
    },
...

(sorry for the verbose headers!)

GET http://api.serverfault.com/1.1/users/6246/top-answer-tags?key=P5K7zSMTYk-Has4Spe848g&jsonp=jsonp12980289083367&_=12980289093903232
    
200 OK
        
611 B
    
233ms
    
ParamsHeadersPostPutResponseCacheHTMLCookies
Response Headersview source
Cache-Control   private
Content-Type    application/json; charset=utf-8
Content-Encoding    gzip
X-AspNetMvc-Version 3.0
X-RateLimit-Max 10000
X-RateLimit-Current 9998
X-AspNet-Version    4.0.30319
Date    Fri, 18 Feb 2011 13:27:37 GMT
Content-Length  611
X-Antivirus avast! 4
X-Antivirus-Status  Clean
Request Headersview source
Host    api.serverfault.com
User-Agent  Mozilla/5.0 (Windows; U; ...
Accept  text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8,application/json
Accept-Language en-gb,en;q=0.5
Accept-Encoding gzip,deflate
Accept-Charset  ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive  115
Connection  keep-alive
Cookie  __utma=81883924.1801528020.1274785032.1286198914.1286791946.7; __utmz=81883924.1286791946.7.5.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=nginx%20does%20not%20pass%20request%20to%20apache; __qca=P0-1856570125-1274785031953
x-insight   activate
Pragma  no-cache
Cache-Control   no-cache

{
  top_tags: {
    0: {
      tag_name: "linux",
      question_score: 2,
      question_count: 1,
      answer_score: 37,
      answer_count: 19
    },
    1: {
      tag_name: "apache",
      question_score: 4,
      question_count: 1,
      answer_score: 35,
      answer_count: 21
    },
...
Andy
  • 143
  • 5