Pergunta

Is it possible to disable cross domain security checks in Chromium while running dart application in Dart VM ?

The problem is that it is running on its own port, and thus my application can't send asynchronous requests to my backend which is running on another port.

Yes, I know that I can copy dart file to my backend and it will run just fine, but then I can't debug it.

Foi útil?

Solução

If you're after a stop gap solution, just for debugging, you can use a flag to turn it off in chrome.

[chromium executable] --disable-web-security

This is taken from this post Disable same origin policy in Chrome.

Otherwise, the addition header in the response is the right way to go. Of course, you can swap the asterisk for a list of IP addresses if you want to improve security.

See https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS for more details.

Outras dicas

Adding Access-Control-Allow-Origin: * to response headers on backend should be enough to make cross domain asynchronous requests.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top