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

195
Views
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 answers
Answer question

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 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!