+ Start a Discussion
TLFTLF 

Incorrect response when multiple APEX REST GET calls are made in rapid succession

I've defined three different APEX REST endpoints (call them endpoint A, B and C). Each of these endpoints implements a GET method. I've created a Visualforce page that uses Javascript/AJAX to make calls to these REST endpoints through the AJAX proxy. Everything seems fine until I need to make HTTP GET calls to these three APEX REST endpoints in rapid succession (GET A, GET B, GET C). Analysis of the requests/responses shows that all three request are formed correctly, but the response to GET C is identical to the response for GET B. It seems like it is returning a cached response from the GET B call rather than the real response to the GET C call. If I slow things down, to allow more time in between the calls, the responses are what I would expect. Has anyone encountered anything like this?

TLFTLF

Ok, it turns out this was a Firefox specific issue. Since all requests are sent through the AJAX proxy, the URL was identical for every request (in my case, https://c.na7.visual.force.com/services/proxy). I believe Firefox was caching the third request/response, even though the SalesforceProxy-Endpoint header was different in each case. I don't quite understand why the second request/response was fine, but the third response was a dupe of the second response. I was doing all of my debugging in Firefox/Firebug. When I switched to Chrome, everything was fine. So, my solution was to add a timestamp parameter to the end of the proxy URL like so: https://c.na7.visual.force.com/services/proxy?tstamp=1333394248613. Hopefully this saves someone a bunch of time some day.