Safari failing with CORS

Hi all,

This may not be specifically related to Cesium but I am encountering a problem within Safari 7.0.1 that seems to affect not just Doarama but other demos listed on cesiumjs.org. It may be present in other versions of Safari but I haven’t been able to check.

It appears that Safari is having trouble with cross-origin resource sharing (CORS). Doarama uses terrain information provided by cesiumjs.org and it is these requests that appear to be failing. On closer inspection however, the requests seem successful (200) but the method is OPTIONS. Shouldn’t it be GET? Either way I am a bit stumped by this issue as it is only encountered in Safari. Chrome and Firefox work just fine. I was wondering if anyone could offer me some advice, perhaps someone else here has encountered this?

I’ve included some screenshots to clarify this a bit further. Let me know if require any more details.

Cheers,

Craig

What you’re seeing is a CORS pre-flight request which uses the OPTIONS verb. The “Accept-Encoding” header is not one of the so-called “simple headers” which are permitted to be sent by default, so the browser does the pre-flight check. The cesiumjs.org server doesn’t explicitly allow any extra request headers (wildcards aren’t permitted), so the pre-flight fails.

The real question is why you are seeing an “Accept-Encoding” request header being added to the XMLHttpRequest for the terrain tiles. I tried it locally using Safari 7.0.1 and the terrain tiles are loading normally, though on my laptop Safari is cripplingly slow compared to Chrome or Firefox.

Do you have any code that would be adding an “Accept-Encoding” request header? If so, you should try removing it. If it’s not your code, do you have any Safari extensions that might be modifying the request?

Scott