Please note. all addresses and domains are false.
On my network I have a server hosting a intranet extranet website which is accessable from the outside using a domain. www.sub.domain.com which is pointed via a cname record to my Mikro Tik cloud DDNS host which points to my public IP.
Traffic is directed to the website on a non-standard port www.sub.domain.com:99999 and the router forwards the traffic to the server inside my network which has a local address 192.168.114.114 .
The problem comes when trying to connect to www.sub.domain.com from inside the network which causes the browser to display an “unable to connect” message. Also some devices like tablets and mobiles are sometimes inside the network and sometimes outside.
How could I create a rule so that the traffic know where to go.
Or could I create a java script that catches the local lan ip and then decides dependant on the address what to do with it. And then have that script run when the user initially connects to the domain - like an intelligent redirect.