-
Notifications
You must be signed in to change notification settings - Fork 472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cross-domain middleware compatibility issues after using Dingo API #28
Comments
是否使用的PHP原生 |
@hhxsv5 我看了 那个包没有使用原生的header() |
第三方包吗?文件发下。 |
body数据都正常吗?怀疑代码没走到中间件。 |
@barretzhi 细聊 QQ群:698480528 |
body 正常的,我也在怀疑没走到中间件。 我发现服务启动后bootstarp/app.php 下的文件在每次请求的时候都不走 |
Dingo Api中干掉了Application的全局中间件。 |
好的,谢谢 |
不用中间件实现 public function index(Request $req)
{
$headers = [
'Access-Control-Allow-Origin' => '*',
//...
];
$data = ['now' => time()];
return response()->json($data, 200, $headers);
} 然后,再统一封装一个 |
哈哈,我是这样做的 |
跨域问题可以用nginx解决,这样又快又不需要引入那个包 |
@dickwu 也不错 |
Problem solved partially, at least by now. Here is the solution: Coding @ config/laravels.php as follows:
Git it a try, and wish it would work for you, too. |
目前还是不支持dingo吗? |
@FlameMida 是的 |
我这也是请求一段时间就报跨域错误,没用djingo。用的\Medz\Cors\Laravel\Middleware\ShouldGroup中间件.求大佬帮忙,卡了2,3天了。 |
跨域中间件用的LumenCors , 每次php artisan laravels start 后 前几次 Access-Control-Allow-Origin:* 响应头还是成功的, 几次请求一走 响应头设置的cors 中间件就无效了
The text was updated successfully, but these errors were encountered: