Find Jobs
Hire Freelancers

Cors Policy

$10-20 USD

Cerrado
Publicado hace casi 4 años

$10-20 USD

Pagado a la entrega
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 del proyecto: 25749906

Información sobre el proyecto

4 propuestas
Proyecto remoto
Activo hace 4 años

¿Buscas ganar dinero?

Beneficios de presentar ofertas en Freelancer

Fija tu plazo y presupuesto
Cobra por tu trabajo
Describe tu propuesta
Es gratis registrarse y presentar ofertas en los trabajos
4 freelancers están ofertando un promedio de $25 USD por este trabajo
Avatar del usuario
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 en 1 día
4,1 (13 comentarios)
4,5
4,5
Avatar del usuario
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 en 1 día
3,4 (5 comentarios)
3,4
3,4
Avatar del usuario
Hi This is a very simple solution. Just add the developer certificate in laravel. That will sort it out. Thanks
$15 USD en 7 días
0,0 (0 comentarios)
0,0
0,0
Avatar del usuario
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 en 1 día
0,0 (0 comentarios)
0,0
0,0

Sobre este cliente

Bandera de MALAYSIA
Petaling Jaya, Malaysia
4,9
31
Forma de pago verificada
Miembro desde jun 29, 2010

Verificación del cliente

¡Gracias! Te hemos enviado un enlace para reclamar tu crédito gratuito.
Algo salió mal al enviar tu correo electrónico. Por favor, intenta de nuevo.
Usuarios registrados Total de empleos publicados
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Cargando visualización previa
Permiso concedido para Geolocalización.
Tu sesión de acceso ha expirado y has sido desconectado. Por favor, inica sesión nuevamente.