0

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
WITO
  • 445
  • 6
  • 13
  • In backend what you using as a server? e.g. nodejs, php, GoLang ... – Snehal Dangroshiya Jul 11 '18 at 04:54
  • PHP 7 with ZendFramework 3. at 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 https://app.domain.io Content-Length: 1335 Keep-Alive: timeout=5, max=99 Connection: Keep-Alive Content-Type: application/json; charset=utf-8 – WITO Jul 11 '18 at 11:42

1 Answers1

0

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")

LightNight
  • 851
  • 1
  • 6
  • 14