0

The title pretty much says it all. I know I can bypass it in my browser with --disable-web-security (for chrome) but how does it work for releasing the app? I have no access to the server that is set to deny reverse proxies and only accepts GET requests not OPTIONS this leads to prefight issues. How can I work around this?

I've taken a look at these but they don't seem to answer the prefight from release workaround. Any Suggestions/workarounds?

http://blog.ionic.io/handling-cors-issues-in-ionic/

https://blog.nraboy.com/2014/08/bypass-cors-errors-testing-apis-locally/

4

2 回答 2

0

您不必担心 ionic 应用程序构建中的 CORS,因为在最近的 ionic 项目中,cordova 插件 cordova-whitelist 已经作为 config.xml 的一部分放置,因此当您进行构建时,它会通过以下方式处理 CORS 问题本身。

于 2017-01-17T04:58:06.293 回答
0
  • 下载 Chrome cors 扩展
  • 不要从服务中调用 post call,从控制器中调用
  • 在服务器端,确保每条可用路由都有一个可选路由
  • 执行这样的发布请求

    $http->post('你的 api', your_data) .success(function(response) { ..}).error(function (error) {..})

.finally(function() {..});

  • 如果您的服务器使用 laravel 运行,还可以获得 palanik/lumencors
于 2016-09-23T19:10:46.990 回答