-1

I host my own webserver through Java. The problem is I can only access it through a web browser by using an ip address. Can I spoof a url? For example, I type in 192.168.2.111 into the address bar, I want this to switch to a url.

  • 3
    Ever consider looking at a Hosts file or DNS to fix this? en.wikipedia.org/wiki/Hosts_(file) may be useful. 192.168.2.111 is a URL. "Domain Name" is likely what you meant I suspect. – JB King Aug 17 '16 at 22:57
  • Would this only work for my machine, or would incoming connections see this as well? – bob smith Aug 17 '16 at 23:28
  • The Hosts file change could be done on machines to make this run on other computers though isn't likely a great fix globally. Using DNS properly would be better and not really that hard in my experience though it isn't something that can be answered as a simple single question on a SE site. – JB King Aug 17 '16 at 23:35
1

If you have a DNS server for you LAN, assign a name to the IP address in it. As you have listed a private IP address, you should not assign that address on an internet facing DNS server. Your DNS server will provide the IP address to any systems wanting to connect o your web server.

If you have only one or two systems that need to connect to the webserver, then is the hosts file would work perfectly well.

If you want connectivity from the internet, then you would use your IP address in an internet facing DNS server. You then need to configure your router to forward web traffic to the system running your webserver. It will likely be difficult to get this route to work inside your LAN.

Autoconfiguration can be be done by installing zeroconf the server and client. Both should register their names in the local domain used by zeroconf.

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.