jquery - Cannot set custom request header on ajax calls from my local developing server -


im trying set local dev js client call remote server serves rest api. server functional , tested. when try execute javascript locally cannot set custom headers. im aware of cross domain policy, , fix im executing chrome using --disable-web-security allow cross domain calls. calls going, when check request header there no trace of custom headers.

im setting 2 headers in dev server using jquery im setting them in production:

        var ajaxoptions = {             ajax: {                 headers: { 'x-app-key': appkey, 'x-auth-token': token },                 //and other stuff 

my api respond , error telling me header missing, , checking console cant see where: enter image description here

what missing?

yep, struggling now, , appears there no way set custom header cross domain ajax request unless have cors set on server. custom headers trigger preflight request, see here http://techblog.constantcontact.com/software-development/using-cors-for-cross-domain-ajax-requests/


Popular posts from this blog