使用Rally.data.wsapi.Store的CORS错误

时间:2018-05-25 17:14:45

标签: cors rally

我在Agile Central App SDK 2.1中有一个应用程序,它可以很好地迭代一堆或项目来获取发布详细信息。 我刚刚添加了三个新项目,其中2个工作,其中一个导致错误:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at 
https://rally1.rallydev.com/slm/webservice/v2.0/Project/202236741040?fetch=ObjectID%2CName%2CState%2CWorkspace%2CSchemaVersion%2CWorkspaceConfiguration%2CDateFormat%2CDateTimeFormat%2CDragDropRankingEnabled%2CBuildandChangesetEnabled%2CTimeZone%2CWorkDays%2CIterationEstimateUnitName%2CReleaseEstimateUnitName%2CTaskUnitName%2CChildren.
(Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

奇怪的是,如果我从该错误消息中删除了确切的URL并将其粘贴到浏览器中,我会得到预期的正确结果,没有错误,警告并且肯定没有CORS问题。

如果我将ObjectID更改为另一个已知良好的ID,我将获得完全相同的JSON有效负载,但具有不同的项目名称。 换句话说,如果我将URL放入浏览器,它会起作用,但如果通过'Rally.data.wsapi.Store'调用,则会出现CORS错误。

我试图尽可能简化应用程序,但仍然这样做:(

Ext.create('Rally.data.wsapi.Store', {
    model: 'release',
    fetch: ['Name'],
    autoLoad: true,
    context: { 
        project: "/project/202236741040"
    },
    listeners: {
        load: function(store, records) {
            console.log(records);
        }
    },
    scope: this
});

1 个答案:

答案 0 :(得分:0)

I have seen issues like this myself at times. When it occurs, I clear our my browser cache and it seems to go away.....for a while. I haven't yet sussed out why this works, but you could give it a try.

Whenever the problem is insistent (i.e. it won't clear), I open the developer tools in Chrome which has the "disable cache when open" flag set and it also fixes it.