| Page 1 of 1 | [ 9 posts ] |
|
Hi everyone,
I recently tried updating from YUI 3.1.2 to 3.2.0, and now my xhr requests in Chrome dev, and Safari 5.0.2 give me this error: XMLHttpRequest cannot load myurl. Origin mydomain is not allowed by Access-Control-Allow-Origin. What happens is the first xhr request goes through fine, but subsequent requests no longer have the Origin header, even though I'm including my xhr config in the config object. This was (and does) work with YUI 3.1.2, and I haven't changed any of my code, so I'm wondering what changed in Y.IO between the two. I read through the change notes and looked at the ticket list for IO and didn't see what could be causing it. Has anyone else ran into an XHR request issue with YUI 3.2.0? Note - Firefox 3.6 works fine, and IE 8 works fine (we use the .swf for IE). Thanks, Jed |
|
I cannot think of any changes that would produce the described outcome. Any chance I could have a look at a functional example?
Regards, Thomas |
|
I don't have one publicly available, but I'll write one up and post as soon as I can.
Thank you, Jed |
|
Some more info:
If I switch to using the .swf object it works fine. It's only when I use: if ('withCredentials' in xhr) { xdrConfig = { use: 'native', credentials: true }; } else { //flash stuff } that Chrome and Safari stop working.They fall into the first branch (along with FF). |
|
It looks like there was a change in the _setHeaders() method in io-base.js that may be the culprit. We're going to debug through it to verify if it is or not. I'll post an update with what we find.
Thanks, Jed |
|
You may be looking at the resolution of this ticket: http://yuilibrary.com/projects/yui3/ticket/2528893
Regards, Thomas |
|
I did see that ticket, which made me think it was something there. We did track it down to the following line being removed in 3.2.0:
io-base.js method: _create(c, i) Code: // Remove the custom header when making cross-domain // requests to avoid unintended pre-flight requests // or access control conflicts. delete _headers['X-Requested-With']; If you add this back in, then you can make cross-domain requests with Webkit. I'm not sure why that line was removed, and if something was supposed to be added somewhere else that got missed. Is there something we need to do differently for Webkit now compared to Mozilla? Thanks, Jed |
|
I see. After that was implemented (removing the "X-Requested-With" header from XDR requests), I received multiple requests to have it reinstated, simply because people had expected the default header to be issued.
The ability to suppress a default header, but not delete it, was recently pushed to development master (please see: http://yuilibrary.com/projects/yui3/ticket/2529324). I believe this will address the current issue. Or, you can just delete the custom header if it is of no consequence to your application. Please let me know if that resolves the issue for you. Apologies for the inconvenience. Regards, Thomas |
|
Hi Thomas,
We used the ability to remove the header and now everything seems to be working fine, so thank you! Also, there is a bug on chrome's list pertaining to this, since it's really a bug on there end: http://code.google.com/p/chromium/issues/detail?id=55830#c1 Thanks for the timely replies and help, Jed |
| Page 1 of 1 | [ 9 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group