Home > Enterprise >  Make a request from my localhost client without cors error
Make a request from my localhost client without cors error

Time:11-08

I need to make a request from my localhosted nodejs/express js client to a 3rd party API that I hosted on the cloud. However each time I am trying I get a cors error. Curiously It works when I do the same request from postman but not from localhost with my nodejs app.

$.ajax({
          type: "POST",
          url: url,
          data: file,
          processData: false,
          contentType: false,
        })

Any suggestion ?

CodePudding user response:

please can you share more details about question and also share package.json file.

Solution:- Use a proxy to avoid CORS errors.get reference of this https://github.com/Rob--W/cors-anywhere/issues/301 it might help you out

  • Related