Stop NW.js from trying to connect to the internet

86 Views Asked by At

I'm creating a simple offline hobby app, that doesn't use the internet for anything, using NW.js.

Although nowhere in my app is there any call to the internet, my firewall tells me nw.exe keeps trying to connect to the internet every time I run the app.

Is there a way to stop NW.js from making any calls to the internet?

I looked up the IP, it's apparently calling Google, I imagine this must be something from Chromium.

2

There are 2 best solutions below

1
The Jared Wilcurt On

This seems to be something Chromium does, rather than NW.js. But since NW.js is built on top of Chromium it inherits it.

Some related GitHub issues:

One suggestion is to add the following to the package.json:

"chromium-args": "--proxy-server=http://127.0.0.1"

This will prevent any external network calls from working. Which sounds like what you want. Give it a try, if it does not work and you have additional information, you should contribute to those GitHub issue threads.

0
flen On

Ok, this seems to be a well known issue for many years: https://github.com/nwjs/nw.js/issues/5865 . It's still an open issue.

As per the Github thread, apparently adding switches to chromium-args in the manifest doesn't work anymore. I tried adding them manually when starting the app in the command line, it also didn't work. My list of switches is quite ridiculous at this point: "chromium-args": "--proxy-server='http://127.0.0.1;https://127.0.0.1' --disable-sync --disable-background-networking --disable-component-update --host-rules='MAP * 127.0.0.1' --disable-http-cache --disable-http2 --disable-ntp --disable-renderer-backgrounding --disable-sync --disable-features=NetworkService".

The good news is that it seems all calls are being redirected to localhost, but I can't confirm since I set my firewall to block all of them from completing (I don't know what they'd do if there was a response). Unfortunately, I don't think there's a solution right now, which is a dealbraker for me.