algoliasearch-client-javascript icon indicating copy to clipboard operation
algoliasearch-client-javascript copied to clipboard

remove the OPTIONS CORS call

Open ymschaap opened this issue 12 years ago • 6 comments

https://github.com/algolia/algoliasearch-client-js/commit/f97236b1d2183a2b4d478469bdf22ddb81d4e8ec commit reverted the setting of custom request headers because it didn't stop the OPTIONS request for CORS.

It mentions the request being POST still demands a OPTIONS request.

I found that if you set the Content-Type to: application/x-www-form-urlencoded and no custom headers you skip the OPTIONS request.

Try my version: http://directlyrics.com/algolia/ac.html

ymschaap avatar Nov 24 '14 18:11 ymschaap

Sorry for the late answer, you are right about the OPTIONS request. We will remove it in our next release of JS API client to improve performance

speedblue avatar Jan 05 '15 11:01 speedblue

@ymschaap This was solved in a06c2716760cace47ddc331694476625dc3dbbe2.

Latest release have this fix in, https://cdnjs.com/libraries/algoliasearch

vvo avatar Feb 16 '15 12:02 vvo

Latest version is again sending the OPTION query -> looks like the content-type is not anymore set to application/x-www-form-urlencoded from the browser.

redox avatar Jun 07 '15 17:06 redox

Where do you see it? Cannot reproduce

vvo avatar Jun 07 '15 18:06 vvo

Ok seems to be only the angularjs build that is bugged with this, will solve tomorrow morning.

vvo avatar Jun 07 '15 18:06 vvo

Solving.. Found a clear reference on simple requests: https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS#Simple_requests

vvo avatar Jun 08 '15 08:06 vvo