Search code examples
javarichfaceswarwildflywildfly-8

Redirect war to main domain?


I have a RichFaces WAR file that deploys itself to http://mytestserver:8080/mywarapp/index.jsp. I deploy it on the Wildfly Application Server.

Now I would like to access the WAR file not through this long http-address, but through the main server address: http://mytestserver/

How would I have to do that?


Solution

  • You should change context path of your application.

    To do this you need to create file jboss-web.xml and place it in WEB-INF directory. jboss-web.xml should contain:

    <?xml version="1.0" encoding="UTF-8"?>
    <jboss-web>
        <context-root>/</context-root>
    </jboss-web>
    

    If you want to change port of your application from 8080 to 80 you can do this in few ways.
    1) [not recommended] change port in your standalone/domain.xml from 8080 to 80 and run wildfly as a root/administrator
    2) run nginx/apache or any other webserver and create there proxy redirect eg. in nginx you need to add to your configuration file something like this proxy_pass http://mytestserver:8080/; (if you didn't add jboss-web.xml you need append here mywarapp to this URL ) and your application will be available via URL http://mytestserver/