0 Replies Latest reply on Dec 31, 2018 4:37 PM by gmarshall56

    URL Rewrite Possible - Wildfly 15?

    gmarshall56

      Hello:

       

      In Wildfly I need to have a redirect occur. 

       

      I currently have our application's ear file deployed in server-one in the main-server-group - all configured  in the domain.xml file.  In a browser I can execute this app by going to the URL  https://127.0.0.1:8443/myapp

      As we deploy this ear file to separate servers, we would like the URL to access the app to be <<domain name>>/myapp.  To make this work I have updated the domain.xml file as such:

       

                  <subsystem xmlns="urn:jboss:domain:undertow:8.0" default-server="default-server" 
                          default-virtual-host="default-host" default-servlet-container="default" 
                          default-security-domain="other">
                      ...
                      <server name="default-server">
                          <http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true"/>
                          <https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="true"/>
                          <host name="default-host" alias="localhost">
                              <location name="/" handler="welcome-content"/>
                              <http-invoker security-realm="ApplicationRealm"/>
                               <filter-ref name="http-to-https" predicate="path-prefix('/')"/>
                          </host>
                      </server>
                      ...
                      <handlers>
                          <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
                      </handlers>
                     <filters>
                          <rewrite name="http-to-https" redirect="true" target="https://127.0.0.1:8443/myapp%U"/>
                     </filters>
                     ...
                     ...
                 </subsystem>
      
      

       

      So what I am trying to do is have Wildfly, when it receives an incoming URL that is, for example "localhost/myapp", or "https://DevDeployServer/myapp" or "https://QADeployServer/myapp" or "https://ProdDeployServer/myapp" (depending on the deployment server) to do a redirect (rewrite?) to https://127.0.0.1:8443/myapp

       

      What I have here is not working.  Can somebody please let me know if a rewrite can be done this way?  If so please educate me on how to make this work.

       

      My apologies.  I am learning how to stand up and configure a Wildfly domain configuration as I move along. Thank you for your assistance.

      -g