let's say

1) I have a server running in a private intranet. It uses tomcat to serve a webapp at privateserverip:8080/appname

2) I have a myapp.local domain and when I enter it toplevel with http://myapp.local it serves the app from privateserverip:8080/appname if the request comes from within the intranet

That is the actual state.

Now: I have a public domain: example.org and I want that if a website redirects a user, who is in the intranet (!), to myapp.example.org, privateserverip:8080/appname should be served. If somebody from outside the intranet hits myapp.example.com nothing should happen.

Please tell me that this is possible!? :)

I could configure vhost in an nginx at example.com but also create DNS entries and stuff like that for example.com. Everything you want. Just tell me that this is possible

Thanks for your help :)


One of two ways:

  1. You point your local clients to a DNS server in your intranet that serves the internal IP address of your webserver for all requests going to myapp.example.com/appname (you have to use the appname in the URL or a simple IP mapping won't work).
  2. You change the DNS settings of example.com and add an A record that points to the internal IP address of your webserver. Fortunately, people outside the network won't be able to access your internal network, but they will know the (internal private) IP address of the server, which can be a security concern.

I'd suggest #1, if you can. You can normally do this on your router (it is generally your DNS server).

  • I am not so confident with this DNS stuff, but would it be possible to create a CNAME record on example.org so that myapp.example.org queries myapp.local? – alsdkjasdlkja May 20 '15 at 19:35
  • Yes, that would work perfectly. – IceMage May 20 '15 at 19:47
  • THANK YOU! :))) Can I marry you? ;P – alsdkjasdlkja May 20 '15 at 19:50
  • Step in line lol. – IceMage May 20 '15 at 20:01

Why do people keep mixing private and public? There is nothing wrong about internal users connecting to the private url (http://myapp.local) and external users connecting to the public url (http://myapp.example.org). Anything else is just a workaround to the good practices.

  • 2
    Because it was never good practice, and it is even worse now that any arbitrary string can be a TLD. – Michael Hampton May 8 '19 at 16:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.