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

227
Views
'http://localhost:3000' has been blocked by CORS policy - For external API

I don't have access to an external API but I am being blocked out by CORS. I have also enabled "Access-Control-Allow-Origin" in the Axios post config. Most answers are tailored to a local api. How do I get around this?


const auth = {
  username: "xxx",
  password: "xxx",
};

const res = await axios.get(
      `https://api.staging.CORP.dev/stuff/{my-key}/pub_id`,
      { auth },  
        {
        headers: {
          "Content-Type": "application/json",
          "Access-Control-Allow-Origin": "*",
        },
      }
    );
    const pub = res.data.map((pub) => ({ puv_id: pub.id }));
    const data = {
      address: {
        postcode: 'PostCode',
      },
      full_name: 'name',
      email: 'email',
      pub_id: pub
    };
    axios
      .post(
        "https://api.staging.CORP.dev/stuff/{public}/orders",
        data,
        { auth },
        {
          headers: {
            "Content-Type": "application/json",
            "Access-Control-Allow-Origin": "*",
          },
        }
      )
      .then((res) => console.log(res))
      .catch((err) => console.log(err.response));
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can try adding "proxy": "http://localhost:3000", in your package.json

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!