Monday, December 12, 2011

XHR call results in browser doing an OPTIONS method request

This issue got me bugged for a while, XHR request when inspected in firebug seems to be sending out a HTTP OPTIONS method. If this happened to you, suggest the first thing to check is if the XHR is trying to do a cross-domain request, apparently 127.0.0.1 and localhost are being treated by my firefox as being cross-domain. I always thought cross-domain was not possible with XHR but apparently things changed and it is actually possible now (that's if you have control of the server you are trying to 'cross-domain' to) cause it involves sending bunch of Accept-* headers back. In a nut shell, the browser might sent an HTTP OPTION method request to find out if that piece of resource is allowed to be 'cross-domained'. Googleling gives me the followings

No comments:

Post a Comment