Electron webSecurity option not working



I have the same question as stated here: http://stackoverflow.com/questions/32691670/electron-use-post-request-fails

Just in case the question is deleted in the mean time, I’ll pasted it below:

I am trying to turn my node app into a desktop using Electron. In my current code I use a “POST” request and the res.send() to return data back from my node script. Express handles the end points.

However, when I try and use the same code with Electron I get


I have spent lots of time trying to figure a solution and it seems this could be caused by the CORS issue and so have added

"web-preferences": {
  "web-security": false

To my Electron BrowserWindow config but this has not helped.

Can anyone share a sample of doing a JQuery POST request in Electron. Be a big help. Thanks

Does anyone have idea why isn’t this working ? A bug, maybe ?

Thank you!


I think the problem is at the server not your app, because your app is reaching the server but the server is refusing. Maybe the the firewall or anti virus is blocking? showing your request and server handle code could help too. Look if the server ask for https or http.

About the JQuery POST is the same of any another remember your electron app is kinda running in a browser.

I setup a server with express and no problems here by the way i using a npm packge called request to talk to the sever.
see https://www.npmjs.com/package/request
here’s example of using express http://expressjs.com/en/starter/hello-world.html double check the listening door