Wildfly standalone in local network
Asked Answered
M

4

14

I need some way to give access to my web application frontend (which is on localhost:8080 by default) to local network users (192.168.x.y). Assuming that my ip is 192.168.1.72, I want other client in my network could view my application frontend in his browser by typing 192.168.1.72:8080 in address bar. Is there any way to launch Wildfly standalone instance in my local network instead of localhost? Or is there another solution (maybe I could somehow connect my address in local network to localhost)? Sorry for silly quiestion

Moan answered 2/2, 2015 at 20:30 Comment(1)
Try running it on port 80, as this is the default website port (unless of course you are running another website). Then people could just type your ip into the browser and be directed to the webpage. Make sure your firewall doesn't block port 80 just in case.Laclair
B
32

The standalone.bat/standalone.sh startup scripts accept a bind parameter so you can bind the application server to specific IP addresses for incoming requests.

For example standalone.bat -b 0.0.0.0 will start Wildfly listening on all your IP addresses.

Possible parameters: 0.0.0.0 for all IP addresses, 127.0.0.1 to listen just on localhost, 192.168.1.72 to listen just on your LAN IP (then even from your local machine you need to enter the LAN IP). Note: This only changes the IP it's listening on, the port remains 8080 or whatever you have configured.

You have -b parameter for normal client serving bind address an you also have -bmanagement for the management interface. This is the interface on which you can connect to the admin console via browser or via remote protocols.

Even if you give remote access to the web applications inside it's good to reserve the management interface just for you. So for example:

standalone.bat -b 0.0.0.0 -bmanagement 127.0.0.1 will enable anyone to connect but only local connections for management.

Bentonbentonite answered 2/2, 2015 at 20:39 Comment(1)
Hi, @Cristian, using -b 10.0.0.17 parameter, I can access the web server on the machine which hosts the web server, but can't access from other machines in the local network. Does that have something to do with my ISP provider? I use comcast xfinity internet service. Thank you.Recommit
L
13

If you want to do this "manually", you could set a different IP address by changing the public interface in the standalone.xml file. It should look like this:

<interface name="public">
    <inet-address value="${jboss.bind.address:192.168.1.72}"/>
</interface>

So, the server is now listening only on the specified IP address (after restarting). If you want to allow all available network interfaces, you should place a 0.0.0.0 instead (be careful with this).

Lorrielorrimer answered 4/5, 2016 at 18:25 Comment(0)
T
2

If you want to allow all IP address you can put in your standelone.xml :

<interface name="public">
        <any-address/>
</interface>

Maybe better solution if you change network....

Tarnetgaronne answered 29/6, 2019 at 22:28 Comment(0)
N
1

If you're developing a web app using Eclipse with WildFly and you want to access your web app from another machine/device (e.g. test its responsive design), edit your launch configurations properties. Change localhost to 0.0.0.0.

From:

-mp "C:\wildfly-14.0.1.Final\modules" org.jboss.as.standalone -b localhost --server-config=standalone.xml -Djboss.server.base.dir=C:\wildfly-14.0.1.Final\standalone

To:

-mp "C:\wildfly-14.0.1.Final\modules" org.jboss.as.standalone -b 0.0.0.0 --server-config=standalone.xml -Djboss.server.base.dir=C:\wildfly-14.0.1.Final\standalone

Then uncheck "Always update arguments related to the runtime". You should be able to access your web app using http://ip:port.

Nagano answered 1/1, 2019 at 13:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.