I have an internal web server that I'd like to set up a subdomain for. Right now I have it set up like the following:
http://remote.domain.com - CNAME A-Record points to our office's public IP address, which port forwards to the internal server. Used when accessing from outside the office.
http://office.domain.com - CNAME A-Record points to the internal IP address of the web server. Used for accessing the web server from within the office network. This is preferred especially due to the amount of large images hosted on this webserver, it's faster locally than through our slower internet pipe.
My question is, is it possible to create, say, http://dynamic.domain.com which will automatically route to the appropriate IP based on the user's IP address? So if the user is requesting the site from within our office IP, it would use the local internal IP address and route traffic locally. Otherwise, if the user is requesting the site from some remote IP, it would route to our office's public IP address and route traffic over the internet.
This would allow me to always send out links using the single http://dynamic.domain.com url, and whether the recipient was remote or within the office at the time, it would provide the most appropriate connection for them at that time.