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

235
Views
axios post request retrning error: Cross-Origin Request Blocked

i am using axios to post some data to my node server but its giving me this error:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at MY_NODE_URL. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

this is my code:

 const url = "https://blooming-escarpment-74540.herokuapp.com/blog/postBlog";

 axios
    .post(url ,{
        title: document.getElementById("title").value,
        post: document.getElementById("post").value,
        blogImage:document.getElementById("blogImage").files[0],
     
    })
    .then((response) => {
      const result = response.data;
      if (result.status == "SUCCESS") {
       console.log("SUCCESS");
       
      } else {
        console.log("BAd");
      }
    })
    .catch((error) => {
      console.log(error);
    });

this error still shows even if i use fetch API or even XHR

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

you have to install the cors package on your node js backend

Usage

const express = require('express')
const cors = require('cors');

const app = express();
app.use(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!