Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

192
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda