【发布时间】:2018-10-24 04:31:11
【问题描述】:
我有一个 laravel/lumen 服务器来管理我的云资源的上传。我还将服务器用作前端应用程序的 API 端点。其中一个端点从 Cloudinary 返回一个文件。我通过将请求重定向到 Cloudinary 资源来做到这一点。但是我的应用程序失败了,因为重定向资源上没有 CORS 标头。
return redirect()->to("https://res.cloudinary.com/gates/raw/upload/" . $upload->id);
我得到的错误是:
Redirect from 'https://{my-server.com}/api/v1/export' to
'https://res.cloudinary.com/gates/raw/upload/{upload-id}' has been
blocked by CORS policy: No 'Access-Control-Allow-Origin' header is
present on the requested resource. Origin 'https://{my-frontend.com}'
is therefore not allowed access.
【问题讨论】:
标签: php laravel cors cloudinary