Find Jobs
Hire Freelancers

Cors Policy

$10-20 USD

已关闭
已发布将近 4 年前

$10-20 USD

货到付款
Presently in my angular 9 application my post has the following header being set: const httpOptions = { headers: new HttpHeaders({ 'Content-Type': 'application/json', 'Accept' : 'application/json' }) }; Then in my laravel application, I have modified the [login to view URL] file as below: protected function getRouteForMethods($request, array $methods) { if ($request->method() == 'OPTIONS') { return (new Route('OPTIONS', $request->path(), function () use ($methods) { //return new Response('', 200, ['Allow' => implode(',', $methods)]); return new Response('', 200, [ 'Allow' => implode(',', $methods), 'Access-Control-Allow-Origin' => '*', 'Access-Control-Allow-Credentials' => 'true', 'Access-Control-Allow-Methods' => 'GET, POST, PUT, DELETE, OPTIONS', 'Access-Control-Allow-Headers' => 'X-Requested-With, Content-Type, X-Auth-Token, Origin, Authorization' ]); }))->bind($request); } $this->methodNotAllowed($methods); } Also in each of my laravel controller, I have included: public function __construct(){ //header('Access-Control-Allow-Credentials: true'); header('Access-Control-Allow-Origin: *'); } However, after deployment to my VPS running on Centos operating system, I receive the following error when accessing from my browser: Access to XMLHttpRequest at '[login to view URL]' from origin '[login to view URL]' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. With the settings above, on the localhost, the error above is resolved. However, when deployed to the production environment the problem crops out. You are required to work on this remotely.
项目 ID: 25749906

关于此项目

4提案
远程项目
活跃4 年前

想赚点钱吗?

在Freelancer上竞价的好处

设定您的预算和时间范围
为您的工作获得报酬
简要概述您的提案
免费注册和竞标工作
4威客以平均价$25 USD来参与此工作竞价
用户头像
hi. I'm experienced in CORS, and I can resolve the issues of CORS at your production deployment. Can you please contact me. Thank you
$30 USD 在1天之内
4.1 (13条评论)
4.5
4.5
用户头像
Hi, cors policy need to add at API, not at angular system. if you have access of that API, add header. if need my help, pls hire me. Thanks R
$35 USD 在1天之内
3.4 (5条评论)
3.4
3.4
用户头像
Hi This is a very simple solution. Just add the developer certificate in laravel. That will sort it out. Thanks
$15 USD 在7天之内
0.0 (0条评论)
0.0
0.0
用户头像
Hello, I have read your code, but perhaps something is missing need to check first. Contact me if you're interested for further discussion. Thanks.
$20 USD 在1天之内
0.0 (0条评论)
0.0
0.0

关于客户

MALAYSIA的国旗
Petaling Jaya, Malaysia
4.9
31
付款方式已验证
会员自6月 29, 2010起

客户认证

谢谢!我们已通过电子邮件向您发送了索取免费积分的链接。
发送电子邮件时出现问题。请再试一次。
已注册用户 发布工作总数
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
加载预览
授予地理位置权限。
您的登录会话已过期而且您已经登出,请再次登录。