ExtJS 6.6.0 Enable CORS in form submit

痞子三分冷 提交于 2020-04-28 21:08:27

问题


How to enable Cross Domain in ExtJS 6.6.0

this.getForm().submit({
    url: REST.API_DOMAIN + REST.API_ATTACH + data.id,
    scope: this,
    success: function(form, result) {
        console.info(result);
    },
    failure: function(form, result) {
        console.info(result);
    }
});

Although the REST API is fully cross-domain, ExtJS rejects the response.

response headers HTTP/1.1 200 OK Date: Wed, 11 Jul 2018 11:41:36 GMT 
Server: Apache Content-Encoding: gzip Vary: 
Accept-Encoding Access-Control-Allow-Origin: * 
Access-Control-Allow-Headers: origin, x-requested-with, content-type 
Access-Control-Allow-Methods: PUT, GET, POST, DELETE, OPTIONS X-Frame- 
Options: ALLOW-FROM app.domain.io 
Content-Length: 1335 
Keep-Alive: timeout=5, max=99 
Connection: Keep-Alive 
Content-Type: application/json; charset=utf-8

回答1:


to use cross domain requests you must use jsonp or if you need it in only development process you can run chrome with --disable-web-security flag. (edit shortcut of chrome and add in target something like this:

C:\Users{your_user}\AppData\Local\Google\Chrome\Application\chrome.exe --disable-web-security --user-data-dir="G:\chrome")



来源:https://stackoverflow.com/questions/51256508/extjs-6-6-0-enable-cors-in-form-submit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!