URL re-writing for local vs internet access

Soldato
Joined
18 Jan 2006
Posts
3,140
Location
Norwich
I'm sure there's something simple I'm missing here, can't think on how to do this-
I've got an incredibly simple page of links, which can either be accessed from the local network, or over the internet (Unfortunately its a dynamic IP, otherwise things would be much simpler) The problem is that these links need to incorporate the port number, & protocol like this:
Code:
http://192.168.2.250:10000
https://192.168.2.250:10002
The port works both on the external DynDNS URL that I'm currently using (Mildly related- Anyone got a way to point a spare domain/ subdomain in the same way, using a Tomato WRT54GS?), or on the local IP. I'd rather not try to use the external URL, as this places a reliance on external DNS, but have the page dynamically re-write itself dependant on where its being accessed from.

Cheers

-Leezer-
 
Can you not just run the HTTP server on port 80 instead?

That way you could ust relative paths and voila, problem solved.

Pointing subdomains is handled by your domain registrar (eg, mine is 123 reg) i insert subdomain records pointed at my IP, my webserver uses virtual hosts to distinguish which site the user typed in to serve the correct pages.

For that to work internally i have duplicate records on my internal network pointing to the local IP addresses so everything just works.
 
Not quite following your reasoning ;)
I've got the my main public server structure (Apache, PHP5 SQL etc) running various bits and bobs to start with, this runs on port 80 as standard. Within this, I've added a separate password protected area with the management functions etc. linked from a single HTML page. These form the links as above, for which the port number & protocol may vary, depending on what is being linked to-
This stuff is normally web interfaces for various bits of kit (Transmission BT, NZB server, BackupPC etc), & as such has no interaction with the primary Apache server, but rather runs their own backend on an entirely separate port. I've also got SSH/ VNC links & other bits and peices, all of which have no fixed port.

Subdomain/ domain wise, I'm fully aware that I can point it to a specific IP, my trouble is that the IP in question in dynamic. (Home internet connection!) I can use DynDNS or any one of the similar services, but for this I either have to use their subdomain or pay to use my own, which I'd like to avoid.


Edit: Another thought- What would be the implications (Security &/ or otherwise) of using a Perl script to determine whether the IP is local & then serve a page as appropriate?

Cheers

-Leezer-
 
Last edited:
Point your subdomain/domain at a CNAME record this allows you to point it at a dyndns address.

Either put entries into your local DNS so that depending if you are inside or outside your LAN depends on what IP it points to or use apache's reverse proxy to have all of your other pages served through apache (on port 80 if you want)

Personally there's no way i'd have any of the private config type stuff on the web (phpMyAdmin is there but i haven't got round to hiding it yet), it just adds another layer of security and i use a VPN to admin - i don't even have SSH on the web.
 
Back
Top Bottom