How determine client session location (internet or local LAN)

I have some IP CCTV in client site and need to view them in perspective by Iframe in both local LAN and internet access. The problem is I have some how determine where client session is connected to gateway so dynamically change URL in Iframe. if client connect in local LAN or for internet access. There is no property in session props for that.

Can that be inferred from

No if user use his phone in the site and out site the return value is the same.

Can I force iframe get data from gateway pass the html5 data to client? I mean when I put 192.168.. it run and get page from gateway.
If this can happen I can set to local lP for every case.

Seems that would make it more complex than it needs to be.

I don’t have any of my servers on a public IP to check this out. Does gateway.address change between LAN and WAN connections?

Another thought I had (that I still can’t test out ) might be to use geolocation. It’s more of a spitball idea while sipping my coffee…

No the gateway address is always fix in both public and private.

Imagine you connect to gateway via 4G network at your office. The geo location is not useful here.

Consider using everywhere, and having your local DNS server/forwarder supply the LAN address for queries from inside the LAN. For a simple DNS forwarder like dnsmasq, this is called “localize queries”. (Or just a local override for that host if your local DNS doesn’t serve to multiple subnets.)

1 Like

Thanks. But if in case I don’t have any local DNS, I believe if I can get the client url use use to access gateway, I can easily use it to access my camera.
Is not there any way to know what url user use to access gateway?

Perspective doesn’t appear to have the necessary property (yet?). Consider solving it with DNS anyways, as you won’t be able to use SSL without having the name from the certificate used to actually access the server. You absolutely need SSL for any traffic from outside an isolated network.


session.props.gateway.address will be whatever address the browser/application/etc connected to the gateway using - specifically, Window.location.hostname from JS: