【发布时间】:2017-11-27 00:36:01
【问题描述】:
我在 laravel 中做了一个网站。现在我正在使用 Ionic 3 制作它的移动应用程序。
我在对 laravel 后端进行 API 调用时遇到以下问题。
localhost/:1 XMLHttpRequest cannot load http://xyz.dev/request/login. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8100' is therefore not allowed access.
假设在 laravel 的 web.php 中定义了 12 条路由。
然后在我的 12 个项目中,6 个路由用于桌面 Web 应用程序,其余 6 个路由以 /mobile 为前缀,以便我可以在我的 API 中使用它。
我在通过 IONIC 中的移动应用程序发出任何请求时遇到了这个问题,而后端在 Larave 中。
请帮帮我。
【问题讨论】:
标签: angular ionic-framework cors ionic3