简体   繁体   English

在JBoss 5(或Tomcat 5.5)中禁用'localhost'主机

[英]Disable 'localhost' host in JBoss 5 (or Tomcat 5.5)

I have an instance of JBoss 5.1.0GA with the 'localhost' host and one additional host 'X' configured. 我有一个JBoss 5.1.0GA实例,其中配置了'localhost'主机和一个额外的主机'X'。 Is there a way to disable localhost completely so that all requests will fail unless they are for host X? 有没有一种方法可以完全禁用localhost,以便所有请求都将失败,除非它们是针对主机X的?

I'd like to make sure that any application that gets deployed is not exposed unless it is specifically deployed to the host X. 我想确保除非专门将其部署到主机X,否则不会公开任何已部署的应用程序。

I've tried removing 'localhost' from the Engine section of jbossweb.sar/server.xml but this seems to have no effect. 我尝试从jbossweb.sar/server.xml的“引擎”部分删除“ localhost”,但这似乎没有效果。 I can still connect to applications (eg ROOT.war) by making a request to http://localhost:8080 (with no Host header set). 我仍然可以通过向http:// localhost:8080发出请求(未设置Host标头)来连接到应用程序(例如ROOT.war)。

Start JBoss with the -b flag explicitly set to host X . 使用显式设置为host X-b标志启动JBoss。

The default behaviour is to listen on localhost only, so if the server is currently listening on both localhost and X , then it must've been explicitly configured to do so, most likely by using -b 0.0.0.0 . 缺省行为是仅在localhost上侦听,因此,如果服务器当前正在localhostX上侦听,则必须已将其显式配置为这样做,最有可能使用-b 0.0.0.0 Change the 0.0.0.0 to be the specific host you want to listen on. 0.0.0.0更改为要监听的特定主机。

Try to map localhost to something other than the loopback IP address. 尝试将localhost映射到回送IP地址以外的其他地址。

Change this to something else in your C:\\Windows\\system32\\drivers\\etc\\hosts file. 将此更改为C:\\Windows\\system32\\drivers\\etc\\hosts文件中的其他内容。

localhost 127.0.0.1

You might want to give the IP address of X in place of 127.0.0.1 above! 您可能希望使用X的IP地址代替上面的127.0.0.1!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM