Results 1 to 5 of 5

Thread: cors issue

  1. #1
    Sencha User
    Join Date
    Jan 2014
    Location
    India
    Posts
    110
    Answers
    2

    Default cors issue

    Hi everyone,
    I am stuck in calling data from other domain using service bus, when I try to send get method ajax send first option request which reject by browser(or may be service bus dont know). Can I avoid option request from ajax call, I tried useDefaultXhrHeader but not solve my problem. Here is my code for ajax call :
    Ext.Ajax.useDefaultXhrHeader = false;
    Ext.Ajax.cors = true;
    Ext.Ajax.request({
    url: serviceBusUrl + 'Employee', //?token=' + Base64.encode(decodedURI),
    headers: headers,
    callback: function (a, s, d) {
    debugger;


    },

    });
    Capture.jpg
    Please help me out.

    Thanks,
    Sandy

  2. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,791
    Answers
    585

    Default

    Custom headers activate the pre-flight OPTIONS check.

    https://developer.mozilla.org/en-US/...s_control_CORS

    However, given the error message in the screenshot I wonder whether the server has CORS enabled at all.

  3. #3
    Sencha User
    Join Date
    Jan 2014
    Location
    India
    Posts
    110
    Answers
    2

    Default

    Hi skirtle,
    Yup cors enabled at server side, when i try to get data from this url using token into a ResApi Client it respond properly but ajax send first option request which not came to server.

  4. #4
    Sencha User
    Join Date
    Jan 2014
    Location
    India
    Posts
    110
    Answers
    2

    Default

    any suggestion guy's for this issue

  5. #5
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,791
    Answers
    585

    Default

    What more do you need to know?

    As I mentioned previously the OPTIONS request is caused by custom headers. The page I referenced gives full details of what causes the OPTIONS request.

    Either you need your server to support CORS pre-flighting or you need to drop the headers.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •