Tomcat 接受 IP 吗?
我有一个 Tomcat 应用程序,它充当 Sun Systems Connect 的 Web 服务器/网关(它本身就是通往 Systems Union Accounts 的网关,我怀疑它是通向幸福的大门)。
只要使用计算机名称(或本地本地主机),我就可以通过浏览器访问应用程序的登录页面。 但机器 IP 和本地主机都不允许我看到登录页面。
Sun告诉我这是Tomcat的一个“功能”。不幸的是,开发和生产中的帐户机器具有相同的名称(不同的域),因此我无法判断我是否在开发盒或实时盒上运行测试。 如果不更改盒子名称,我可以强制 Tomcat 接受 IP 吗?
I have a Tomcat app that is acting as a web server/gateway to Sun Systems Connect (which is itself the gateway to Systems Union Accounts that I suspect is the gateway to happiness).
I can access the app's login page via a browser as long as I use the machine name (or localhost when local).
But neither the machines IP nor Localhost allows me to see the login page.
Sun tell me this is a 'feature' of Tomcat. Unfortunatly the accounts machines in development and in production have the same name (different domains) so I can't tell if I am running tests on the dev or live box.
Short of changing the box names can I force Tomcat to accept IPs?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
http://tomcat.apache.org/tomcat-4.1-doc/ config/valve.html 讨论了强制进行 DNS 查找的resolveHosts 标志,也可能通过调整显示为 %A 参数之一的模式,您可以在日志中列出 IP 地址。
http://tomcat.apache.org/tomcat-4.1-doc/config/valve.html talks about a resolveHosts flag that forces a DNS lookup, also maybe with adjusting the pattern shown to one of the %A parameters you could list the IP address in the log.
Tomcat 不知道任何有关 IP 的信息。 IP 仅被视为主机名。您需要确保配置允许该 IP。您有几种选择可以实现这一目标。
如果为引擎添加defaultHost,任何不匹配的主机名或IP都将使用该虚拟主机。例如,
如果您想要更多控制,您还可以将 IP 添加为别名,例如
IP 可能被拒绝的原因有很多,
查看日志可能会告诉您确切的原因。
Tomcat doesn't know anything about IPs. IP is just treated as hostname. You need to make sure the configuration allows the IP. You have a few options to achieve this.
If you add a defaultHost for the engine, any non-matching hostname or IP will use this virtual host. For example,
If you want more control, you can also add the IP as an alias, like
There are many other reasons that an IP may be rejected,
Looking at logs may show you the exact cause.
我已经有一段时间没有使用 Tomcat 了,但我认为默认情况下您可以通过名称或 IP 地址调用 Web 服务。我不知道这是否有帮助,但您可以尝试设置 虚拟主机用于
server.xml
中的IP地址,例如添加类似的节,但将“localhost”替换为您计算机的IP地址。
It's been a while since I used Tomcat, but I thought by default you could call the web service via either name or IP address. I don't know if this will help, but you could try setting a virtual host for the IP address in
server.xml
, e.g. add a stanza something likebut replacing "localhost" with your machine's IP address.