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

170
Views
No hay encabezado 'Access-Control-Allow-Origin' cuando se obtienen datos con REACT de API

Tengo una prueba para obtener productos de una API de empresa.

Ellos me dijeron:

Los orígenes permitidos por CORS para el desarrollo local son "http://localhost:1229"

Así que configuré el proxy en package.json así:

 "proxy": "http://localhost:1229",

Y mi pedido es:

 const apiLink = 'https://example.com/api/checkout/products/'; fetch(apiLink, { method: 'POST' }).then(returnedData => { console.log(returnedData) }).catch(error => { console.log(error) });

Pero sigo recibiendo este error.

 Access to fetch at 'https://...' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

CORS permite obtener contenido del origen http://localhost:1229 así que intente ejecutar el servidor de desarrollo en http://localhost:1229

usando el comando en linux
PORT=1229 react-scripts start
en las ventanas
set PORT=1229 && react-scripts start

o cambiar paquete.json
"start": "PORT=1229 react-scripts start"
"start": "set PORT=1229 && react-scripts start"

about 4 years ago · Juan Pablo Isaza Report
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!