3

我在 tomcat 上部署了我的 java web 应用程序。我可以访问它

https://localhost:8443/myWebAp

但我想用一些域名而不是本地主机来访问它。为此,我在 C:/Windows/System32/drivers/etc/hosts 的 hosts 文件中创建了以下条目

       10.215.134.45   shopCart.myApp.com

现在我使用 url 访问我的应用程序

       https://shopCart.myApp.com:8443/myWebAp

它说找不到网页。虽然只要我输入我的 ip 即 10.215.134.45 而不是 shopCart.myApp.com 它就可以正常工作。另一个奇怪的事情是,如果我输入为

  10.215.134.45   shopCart 

现在访问应用程序

 https://shopCart:8443/myWebAp 

它工作正常,但只要我在 shopCart 上附加一些 .(dot),看起来浏览器就无法针对 shopCart.myApp.com 解析 ip。我没有得到它背后的原因是什么?我也尝试给 127.0.0.1 而不是我的 ip 针对域名,但结果相同

4

1 回答 1

3

This generally happens only if you are behind a proxy, and the browser is using your proxy to resolve the URL rather than using your hosts file/DNS. You should add *.myApp.com to the proxy exceptions list, to ensure that it resolves the IP address for the domain using your hosts file.

于 2012-07-25T12:02:40.007 回答