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.

有帮助吗?

解决方案

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.

其他提示

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top