【发布时间】:2013-07-22 18:21:34
【问题描述】:
我正在尝试从不同的 URL 向 laravel 发出 json 请求,并收到以下错误:
XMLHttpRequest cannot load http://api.core/v1.0/accounting/items/. Origin http://site.dev is not allowed by Access-Control-Allow-Origin.
我尝试在我的后过滤器中设置它,但没有成功。我正在使用 NGINX:
App::after(function($request, $response)
{
$response->headers->set('Access-Control-Allow-Origin', '*');
return $response;
});
【问题讨论】: