简体   繁体   中英

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. Is there a way to disable localhost completely so that all requests will fail unless they are for host 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.

I've tried removing 'localhost' from the Engine section of jbossweb.sar/server.xml but this seems to have no effect. I can still connect to applications (eg ROOT.war) by making a request to http://localhost:8080 (with no Host header set).

Start JBoss with the -b flag explicitly set to host X .

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 . Change the 0.0.0.0 to be the specific host you want to listen on.

Try to map localhost to something other than the loopback IP address.

Change this to something else in your C:\\Windows\\system32\\drivers\\etc\\hosts file.

localhost 127.0.0.1

You might want to give the IP address of X in place of 127.0.0.1 above!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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