Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

180
Vistas
CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource (js/ts)

I'm trying to use axios to make a post request to my backend. Every time I make the request I was receiving this error:

origin 'http://localhost:1234' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

So I added the appropriate header:

const FRONTEND_URL = 'http://localhost:1234'

export async function connect( address:string | undefined, signature:string | undefined ) {
        const url = `${SERVER_URL}/connect`;
        return await axios.post(
          url,
          { address, signature },
          {
            headers: {
              'Access-Control-Allow-Headers': '*',
              'Access-Control-Allow-Origin': `${FRONTEND_URL}`,
              'content-type': 'application/json',
    
            },
          }
        );
      }

I still get the same error. Why isn't it detecting my Access-Control-Allow-Origin header? (I've restarted servers multiple times)

https://masteringjs.io/tutorials/axios/post-headers

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Since you are running the routes in development at it means using various ports you are running into error due to CORS policy. You may look up to these answers as they are provided already with so much explanation enable cors.

Also, you may look at documentation of CORS package CORS

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda