Hi,
On Feb 18, 2013, at 7:49 PM, Sven Anders anders@anduras.de wrote:
It not works because the OPTIONS request is send directly by the browser (not jQuery/client). The problem is that if you want to make a cross-domain query you are VERY limited. For example you can make a GET query but ONLY if that query uses "simple headers" (see http://www.w3.org/TR/cors/#simple-header):
/*A header is said to be a simple header if the header field name is an ASCII case-insensitive match for Accept, Accept-Language, or Content-Language or if it is anASCII case-insensitive match for Content-Type and the header field value media type (excluding parameters) is an ASCII case-insensitive match for application/x-www-form-urlencoded, multipart/form-data, or text/plain.*/
The first problem is that we use the X-client header (it will be removed in the next version) and also a non-simple content type (also will be fixed in the next version to 'text/plain'). The second problem is, that jQuery adds additional (non-simple) headers and we cannot fix this.
If the browser detects the non-simple header situation (before it makes a request itself) it sends an OPTIONS (preflight) request. The result from this request is handled inside the browser - not Javascript. That request asks the remote server for allowed URLs and allowed headers to make cross-domain requests. And because the Mozilla server not sends the required headers (it is OK), the browser (not jQuery) refuse to make the real GET request.
Ok, I think I understand the problem. But I wonder, that jQuery doesn't allow to make simple queries... But it should be possible to use the plain XMLHttpRequest object, right?
XMLHttpRequest maybe works (I am not sure because it usually adds something like "requested with" header) but we do not want to maintain a hybrid. We will use jQuery for all request and rather wait for jQuery fix (if it is really fixable).
JM