Check if internet connection is working behind a proxy

44 views
Skip to first unread message

martink...@gmail.com

unread,
Apr 30, 2018, 11:43:10 AM4/30/18
to nodejs
Hey,

I would like to develop a tool (angular-electron-app) which checks if an internet connection exists or not and this behind a proxy.

So first I tried this module https://www.npmjs.com/package/internet-available .
But it does not work because I'm behind a proxy.

So now I need a module or a solution to check the internet connection through my proxy.

Any ideas?


Thank's for help!


Martin 


Mikkel Wilson

unread,
Apr 30, 2018, 3:42:46 PM4/30/18
to nodejs

What is your proxy doing that is blocking port 53?

Mikkel

martink...@gmail.com

unread,
May 2, 2018, 12:54:36 PM5/2/18
to nodejs
Okay maybe it's not the best module . Do you know a better one? Or do you have a idea how to check it?
I only want to check if there is a internet connection available.

It's the proxy of my company. So I think only save ports are allowed and the other ones are blocked. But I'm not sure which ports are allowed.

Martin

Mikkel Wilson

unread,
May 2, 2018, 2:26:22 PM5/2/18
to nodejs
Oh, you said this was an electron app. There's a DOM event for network connectivity: https://developer.mozilla.org/en-US/docs/Web/API/NavigatorOnLine/Online_and_offline_events

I just tested this with my own electron app and it works. I'm not sure what it's doing under the hood, but without knowing what your proxy is doing, bypassing it will be a challenge.

> navigator.onLine
  true

[turn off wifi]

> navigator.onLine
  false

Easy! But I'm not behind a proxy...

Mikkel

Zlatko

unread,
May 2, 2018, 8:55:59 PM5/2/18
to nodejs
From client's perspective, navigator check doesn't care nor sees proxies. It tries to do a connection and that's it.

Alternatively look at what you've got.
Internet-available makes a dns query, but your proxy/firewall does not allow direct communication. But a simple http fetch should work, if your app uses default system proxy configuration (in vast majority of the cases). So I would guess that a combo of no-direct-dns (or anything outgoing, for that matter), but normal connection from the client-side script which uses something like automatic (OS-controlled) proxy config should tell you it is a proxy.
Reply all
Reply to author
Forward
0 new messages