1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    30
    Vote Rating
    0
    mvosantos is on a distinguished road

      0  

    Default Rest Proxy on a remote server

    Rest Proxy on a remote server


    Hello guys.
    Today I´ve started attempting to consume a rest server.
    When I try to save the model data on a local rest server, ExtJs sends the data as a POST METHOD.
    When I try to save the model on a remote server, ExtJs sends the data as a OPTIONS METHOD.
    What does it mean?
    Why does it happen only on a remote rest server?

    Besides, I don´t receive any kind of answer from the server.

    That is my store:


    Ext.define('Kerp.store.UsExportacoes', {
    extend : 'Ext.data.Store',
    model : 'Kerp.model.UsExportacao',
    autoLoad : false,
    remoteSort : true,
    remoteFilter: true,
    autoSync : true,
    proxy: {
    type : 'rest',
    api : {
    create : 'http://.../index/test',
    read : 'http://.../index/test',
    update : 'http://.../index/test',
    destroy : 'http://.../index/test'
    },
    actionMethods : {
    create: 'POST',
    read: 'GET',
    update: 'PUT',
    destroy: 'DELETE'
    },

    reader : {
    type : 'json',
    root : 'data',
    successProperty : 'success'
    },
    writer : {
    type : 'json',
    root : 'data'
    },

    }

    });

  2. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,593
    Vote Rating
    324
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    The OPTIONS request is a result of cross-origin resource sharing (CORS) - it is a standard browser feature, not part of ExtJS itself. Have a search on Google for more information.

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    30
    Vote Rating
    0
    mvosantos is on a distinguished road

      0  

    Default


    But Why ExtJs changes the method to OPTIONS instead of POST??
    I´m creating a record on a REST server with absolute URL and due this ExtJs changes the Method to POST by itself
    The webservice is waiting for POST, PUT, GET AND DELETE
    Besides, I am trying to send some params but it doesn´t send them

    I am getting crazy....

  4. #4
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,593
    Vote Rating
    324
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    Quote Originally Posted by mvosantos View Post
    But Why ExtJs changes the method to OPTIONS instead of POST??
    Please research CORS as I suggested. ExtJS is not changing the method from POST to OPTIONS, that's being done by the browser as part of CORS.

Thread Participants: 1