WebApp accessible via localhost but not 127.0.0.1

2019-07-27 08:23发布

问题:

i'm running a webapp on Jetty with Maven on my machine (Win7 pro X64) and i'm experiencing some weird problems:

  1. when i try to open it on my browser - it's accessible via localhost but not 127.0.0.1 or my local address (192.168.0.14).
  2. when someone else from my local network tries to access the app he can do it via my computer name but not via my local address.

NOTE:

  1. ping works for localhost and 127.0.0.1. also, i can access 127.0.0.1 (80) with telnet.
  2. windows firewall is off (stopped the service)
  3. nothing defined in hosts file
  4. cleaning DNS and ARP chache didn't help
  5. on other computers in the network the app works fine and i can access it via their ip. we all share the same pom.xml.
  6. error says - "link appears to be

please help me find out what the hell can be the problem

thanks...

回答1:

after a looong evening of trying pretty much everything i think i found the problem - Skype!

after running jetty successfully on 8080 i consulted a friend and he told me about the skype issue. after shutting down skype, jetty runs perfectly on port 80 as well :)

after a quick search i found this - http://www.mydigitallife.info/disable-skype-from-using-opening-and-listening-on-port-80-and-443-on-local-computer/

NOTE: for some reason Jetty isn't throwing an exception like a server should in this situation



回答2:

If you are getting genuine 404 errors, then you are obviously connecting to the Jetty server, but Jetty is deciding not to serve up your application on that address.

It sounds like you've enable virtual hosting on the Jetty server, so that the application is bound only to specific host names, and is therefore not being served up on numeric IP addresses.

I'm not sure how you've wound up in that situation though.