Results 1 to 3 of 3

Thread: The 'Access-Control-Allow-Origin' header contains multiple values

  1. #1

    Default The 'Access-Control-Allow-Origin' header contains multiple values

    Hi,
    I have the following code:


    Ext.define ('Syntax.store.histories', {
    extend 'Ext.data.TreeStore'


    requires: [
    'Ext.data.proxy.Ajax'
    'Ext.data.reader.Json'
    ]


    constructor: function (cfg) {
    var me = this;
    cfg cfg = || {};
    me.callParent ([Ext.apply ({
    storeId: 'histories'
    proxy: {
    type: 'ajax'
    url: 'http: // ServerIP / service'
    actionMethods: {
    read: 'GET'
    },
    headers: 'Access-Control-Allow-Origin'
    reader: {
    type: 'json'
    }
    }
    }, Cfg)]);
    }
    });


    but when run it in the browser on the console shows me the following:


    XMLHttpRequest can not load http://serverIP/service. No 'Access-Control-Allow-Origin "header is present on the requested resource. Origin 'http: // localhost: 8080' is not allowed access


    Should I continue another setting?
    Thanks

  2. #2
    Sencha Premium Member
    Join Date
    Mar 2013
    Location
    England
    Posts
    71
    Answers
    2

    Post CORS headers

    Quote Originally Posted by Alejandra14 View Post
    Hi,
    XMLHttpRequest can not load http://serverIP/service. No 'Access-Control-Allow-Origin "header is present on the requested resource. Origin 'http: // localhost: 8080' is not allowed access
    Hi,

    My understanding, which isnt very deep, is that the header is set on the requested page, not the script making the request.

    I used PHP in one such scenario, I requested data from a PHP script and added this to the top of the script:
    Code:
    header('Access-Control-Allow-Origin: *');
    Careful though this allows everyone, everywhere to access the resource.

    HTH

    Jacko

  3. #3

    Default proxy settings

    Hi,
    I tried with proxy settings, and I did not try what you mention me because in the end was configured server side, so that no mark this message again.
    Thanks for the help

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
  •