问题
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