Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

327
Views
Solicitud de CORS no http cuando la pila MERN de autenticación

He leído varias respuestas sobre este tema, pero ninguna de ellas me funciona hasta ahora. Intenté cambiar la solicitud en el lado del cliente:

 const res = await axios.post(url, body, { headers: { 'Access-Control-Allow-Origin': '*', "Access-Control-Allow-Methods": "*", 'Content-Type': 'application/json', "Access-Control-Allow-Headers": "Origin, X-Requested-With, Content-Type, Accept, Authorization" }, } );

así como configurar el CORS en el backend:

 app.options("*", cors({ origin: 'http://localhost:3000', optionsSuccessStatus: 200 })); app.use(cors({ origin: "http://localhost:3000", optionsSuccessStatus: 200 }));

El mensaje de error en Chrome es: Access to XMLHttpRequest at 'localhost:8000/api/user/register/' from origin 'http://localhost:3000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https.

En Firefox: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at localhost:8000/api/user/register/. (Reason: CORS request not http).

¿Qué estoy haciendo mal?

editar: verifiqué los encabezados de requisitos en localhost: 8000 (el que estoy buscando): ingrese la descripción de la imagen aquí

Parece que localhost:3000 está permitido, pero sigue sin funcionar

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!