Problem with multiple cross domain clients and data cache


I have single OData service with HTTP ETag implemented. I have two javascript clients on different domains which read data from the services using the same URLs service by datajs.createDataCache. When first client reads data from the service everything is ok, when second client (opened in the same browser) reads the same data - it fails. In fiddler first response has ETag header, second request has header If-None-Match and second response returns 304 Not Modified, but client fails. I'm using Google Chrome 12.

file attachments


ATrigo wrote Jul 6, 2011 at 6:11 PM

Thank you for reporting this. Can you share a minimum repro please? At least how are you creating the cache objects and what the call to readRange looks like? DataJS will treat as successful only those HTTP responses whose status code is on the 200 - 299 range. Responses with any other status code are sent to the fail handler of the promise returned by cache.readRange() so they can be handled accordingly.

Is the server returning an ETag header for the collection? Is this OData endpoint implemented with WCF Data Services or some other runtime? Also, in the second request are you setting the ETag header explicitly to the same value you got from the first request?

epodolyak wrote Jul 6, 2011 at 8:50 PM

Really, nothing specific in JavaScript code, I do not specify any ETag specific headers, everything is done by the browser itself. I see the same messages in fiddler when I use dataCache and when I directly opening OData URL.

OData endpoint implemented with WCF Data Services but ETag and If-None-Match implemented as WCF extension as we need ETag support for collections.

I'm attaching headers recorded by Fiddler and javascript code.

Please let me know if you need additional information to reproduce this issue. Note that this is cross-domain scenario, there could be some security issues e.g. not all status codes could be visible for cross-domain ajax.

wrote Jul 6, 2011 at 8:51 PM

epodolyak wrote Jul 6, 2011 at 8:51 PM

Headers attached.

wrote Jul 6, 2011 at 8:51 PM

epodolyak wrote Jul 6, 2011 at 8:51 PM

JS code attached.

wrote Feb 22, 2013 at 12:20 AM

wrote Dec 5, 2013 at 12:36 AM