1. #1
    Sencha User
    Join Date
    Jan 2012
    Posts
    13
    Vote Rating
    0
    koenoe is on a distinguished road

      0  

    Default Unanswered: Problem with preflight requests in a model/store connected to parse.com

    Unanswered: Problem with preflight requests in a model/store connected to parse.com


    Hi there,

    I'm working on a ST 2.1 mobile web app on a REST api at parse.com. It's working fine and fast, but I'm facing a weird problem and I can't figure it out.

    At parse.com I've a data class called 'ReviewType'. My Sencha data model looks like this:

    Code:
    Ext.define('KRNWTR.model.ReviewType', {
    
        extend: 'Ext.data.Model',
        requires: ['KRNWTR.Config'],
    
    
        config: {
            fields: ['color','title','subtitle'],
            proxy: {
                type: 'rest',
                url: KRNWTR.Config.getApiUrl() + 'classes/ReviewType',
                headers: KRNWTR.Config.getHeaders(),
                reader: {
                    type: 'json',
                    rootProperty: 'results'
                }
            }
        }
    });
    And my data store looks like this:
    Code:
    Ext.define('KRNWTR.store.ReviewTypes', {
    
    
        extend: 'Ext.data.Store',
        requires: ['KRNWTR.model.ReviewType'],
    
    
        config: {
            model: 'KRNWTR.model.ReviewType'
        }
    });
    I also have a general option in my config:
    Code:
    Ext.Ajax.setUseDefaultXhrHeader(false);
    The function I call to get my headers:
    Code:
    getHeaders: function(){
            return {
                'Content-Type': 'application/json',
                'X-Parse-Application-Id': this.getApplicationID(),
                'X-Parse-REST-API-Key': this.getApiKey()
            };
        },
    In my controller I'm loading the store and it's dataview in my view is loading the records as it should be:
    Code:
    var store = Ext.getStore('ReviewTypes');
            store.load({
                scope: this,
                callback: this.storeLoaded    
            });
    Code:
    {
                            xtype: 'dataview',
                            store: 'ReviewTypes',
                            itemTpl: '<div class="review-types-item {color}"><div class="review-types-item-description"><strong>{title}</strong><br><span class="small">{subtitle}</span></div></div>'
                        }
    In Chrome it's working fine and shows me these responses:
    screenshot-chrome.jpg

    As you can see there is a preflight request to identify the CORS and it's returning a 200.

    In Safari 6 (Mac OS X) and Safari on iOS I see this:
    screenshot-safari.png

    Somehow I see 3 requests and the one with type 'Other' is causing a problem I think.
    screenshot-safari2.png

    See, no response headers. In Safari iOS (6.0/6.1) the app loads good and fast, but the network activity indicator in the status bar keeps showing activity:
    screenshot-ios.PNG

    I already tried disabling the preflight request by using 'withCredentials:true' in my store/model, but then it throws me the following error:
    Code:
    Cannot use wildcard in Access-Control-Allow-Origin when credentials flag is true.
    .

    Hopefully someone is able to help me.

    Thanks in advance!

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,754
    Answers
    3462
    Vote Rating
    828
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    This must be an issue with how safari is handling the CORS
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Jan 2012
    Posts
    13
    Vote Rating
    0
    koenoe is on a distinguished road

      0  

    Default Yep

    Yep


    Yeah I think so too. In the bug history of Chrome I saw a similar bug and they fixed it. Hopefully Safari will fix it as well.

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi