Results 1 to 4 of 4

Thread: No 'Access-Control-Allow-Origin' header is present on the requested resource

  1. #1
    Sencha User
    Join Date
    Mar 2014
    Posts
    3

    Default No 'Access-Control-Allow-Origin' header is present on the requested resource

    Hi,
    I am trying to make an ajax request to get some data to the app. The problem is that when i am make the request the following error occurs.

    No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access.

    here is the config in the server side :
    Access-Control-Allow-Origin: *
    Access-Control-Allow-Headers: orgin,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type
    Access-Control-Allow-Methods: GET,POST,DELETE,OPTIONS

    and here is the ajax request:
    Code:
    Ext.Ajax.request({
    			url: url,
    			method: 'post',
                params: {
                    origin:origin_data
                },

  2. #2
    Sencha - Support Team
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,410
    Answers
    716

  3. #3
    Sencha Premium Member
    Join Date
    Jul 2014
    Location
    Pune, India
    Posts
    12

    Default

    Chrome does not support localhost for CORS requests.To get around this you can start chrome with the `--disable-web-security` flag (assuming you're just testing).

  4. #4

    Join Date
    Dec 2013
    Location
    Italy
    Posts
    88
    Answers
    9

    Default

    You can add correct headers this way:
    Code:
    Ext.Ajax.request({
        useDefaultXhrHeader: false,
        cors: true,
        url: url,
        method: 'POST',

Posting Permissions

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