Click here to Skip to main content
15,029,333 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a node.js app that uploads images through the code below

app.post("/uploadImage", requiresAuth(), (req, res) => {
  upload(req, res, (err) => {
    if(err) {
      console.log(err);
    }else {
      console.log(req.file);
    }
  });
  res.redirect(req.get('referer'));
});


It works totally fine
But when I enable helmet.js like this:

app.use(helmet({
  contentSecurityPolicy: false,
}));


when I send the post request It shows my website's 404 error page.

how can I fix it?
seems that helmet is blocking my request!
GET requests are working fine but POST requests show error 404!

What I have tried:

the only thing I can do is to remove helmet from my app. and I can't find any solution for this.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900