jednano / iso-http

An HTTP request library that enables isomorphic applications.
MIT License
10 stars 3 forks source link

Triggering CORS pre-flighting on firefox #5

Open DanielHeath opened 9 years ago

DanielHeath commented 9 years ago

The x-requested-with header set in https://github.com/jedmao/iso-http/blob/master/lib/browser/Http.ts#L18 causes firefox to perform a CORS request where it otherwise wouldn't need to.

This adds ~100ms to XHR requests for mobile users. Does it make sense for clients that want this behavior to specify it themselves rather than baking it into the library?

DanielHeath commented 9 years ago

http://stackoverflow.com/questions/8163703/cross-domain-ajax-doesnt-send-x-requested-with-header explains what jQuery does in the same situation and why.