6 Replies Latest reply on Nov 30, 2015 2:43 PM by vished

    Wildfly in local network using URL for example "mywebapp"

    vished

      Dear all,

       

      Just sorry I´m a newbie for using Wildfly.

      I would like to do following:

       

      I have a Standalone Wildfly which runs on my local PC. This PC has a static IP Address (e.g. 192.168.178.2.11)

      Now I would like to open my WebApp also from another PC. This works fine. (I´ve adjust the standalone.xml to "any-address").

       

      Now I have following problem:

      I can open the WebApp only with following URL:

      Computer on which runs my WebApp: localhost:8080

      Other computer: 192.168.178.2.11:8080

       

      But I would like to have:

      Computer on which runs my WebApp: mywebapp.com

      Other computer: mywebapp.com

       

      Is it possible to have also only: mywebapp (without .com) ?

       

      How can I do this?

      Can anybody please help me step by step. Thank you very much.

        • 1. Re: Wildfly in local network using URL for example "mywebapp"
          dlofthouse

          Your question is not really directly about WildFly, it is more about general networking.

           

          There are two parts to what you are asking: -

           

          Ports

           

          At the moment you are accessing http://192.168.178.2.11:8080 and want to access http://mywebapp.com (You may be missing off the http:// but the web browser is assuming that is what you mean) - the number 8080 is the port number that WildFly is listening on - to be able to remove the port number from the address you would need to configure the Undertow listener to listen on port 80.  When you enter an address in the form http://address the web browser actually assumes you entered http://address:80 as 80 is the default port for http.

           

          A couple of other options could be: -

          Install a proxy server that listens on port 80 and passes the traffic through to port 8080

          Use some firewall level configuration to forward requests over port 80 to port 8080.

           

          Host Names


          To access your application server at mywebapp.com or mywebapp is really going to come down to the configuration of your network or possibly at the very least configuration of the client machine accessing the application server.  To achieve this is going to be very specific to your network environment so for this one you would need to speak to an administrator of your network.

          • 2. Re: Wildfly in local network using URL for example "mywebapp"
            gniewkostrowski

            the best way would be to hide your wildfly behind some http server like Apache or NginX:

            here is the main idea and implementation:

            Chris Ritchies Java Blog: Configure WildFly, Apache and websocket connections on Ubuntu 14.04

             

            next, if you want to access it from the other computer saying like: mywebapp, you have to add to the machine's hosts file a line:

            192.168.178.2.11 mywebapp

             

            and in Apache configure your domain name like mywebapp to reverse proxy the Wildfly.

            Then when you enter http://mywebapp on the other machine it will point to your application.

            • 3. Re: Wildfly in local network using URL for example "mywebapp"
              vished

              thank you for your response.

               

              1)

              Ok, I changed the port to 80:

              <socket-binding name="http" port="80"/>

              This works, I can no access the web app also only with: http://192.168.2.11/

               

              2) To change every host file on every device it´s not possible. The computer are dynamic, this means tomorrow are 10 new devices and so on.-

              How can I handle this? How can I change http://192.168.2.11/ to a url like mywebapp ?

              Is this a configuration in the Wildfly? Or any other changes needed?

               

              Thank you very much for any help.

              • 4. Re: Wildfly in local network using URL for example "mywebapp"
                gniewkostrowski

                every device in your LAN, which wants to access your mywebapp must have the hosts file set to your IP and mywebapp,

                I guess your IP does not change too frequently, the other machine is not able to know that mywebapp is your computer if it doesn't have the file set properly...

                and you can set the mywebapp in your standalone.xml

                <server name="default-server">

                                <http-listener name="default" socket-binding="http"/>

                                <host name="default-host" alias="mywebapp">

                                    ...

                                </host>

                </server>

                • 5. Re: Wildfly in local network using URL for example "mywebapp"
                  dlofthouse

                  On your network how do you manage things like IP address allocation?  Do you have any machine or device on your network handling DNS / Naming requests?  If so that would be the place to centrally configure the name to IP address mapping.

                   

                  What operating system are you running?  There are steps to find the nameserver but they are OS specific.

                  • 6. Re: Wildfly in local network using URL for example "mywebapp"
                    vished

                    I´m using a router (LinkSys WRT54). Currently I have also DD WRT inside it.

                    How can I manage this?