3 Replies Latest reply on Aug 21, 2015 12:40 AM by tailorbird indian

    Application runs into a Redirect Loop error WildFly8

    tailorbird indian Newbie

      I was trying to migrate the server from Jboss 4.2.2 to WildFly-8.2.0. Facing some issues while deploying the war file. War is getting deployed, but url rewriting creates issues.

       

      For 4.2.2 the same had been written in a file called `rewrite.properties` in side the localhost folder.

       

          RewriteCond %{REQUEST_URI} !^(.*)[.]([a-zA-Z]+)$

          RewriteRule ^/home/(.*)$ /home/index.php?q=$1 [L,QSA]

       

      As per some documentations, I cam to know that we can create a `undertow-handlers.conf` to my ROOT.war/WEB-INF/ folder, and

       

      how can I put the above in regex[]  format in 'undertow-handlers.conf'

       

      tried this

       

      `regex['/home/(.*)$'] -> rewrite['/home/index.php']`

       

      It seems the url is correctly loading and redirecting to the home page. But application runs into a Redirect Loop error. I was referring [this](https://bugzilla.redhat.com/show_bug.cgi?id=995559)

      and [this](https://help.openshift.com/hc/en-us/articles/202398810) docs. It seems we can configure http connector to prevent redirect loop like this:

       

          <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http" proxy-name="${env.OPENSHIFT_GEAR_DNS}" proxy-port="443" secure="true"/>

       

      But I dont know how to configure this in WildFly 8.

      Secondly, if this issue is due to the missing of RewriteCond in the new regex in 'undertow-handlers.conf'?

       

          ERROR:

          [io.undertow.request] (default task-20) UT005023: Exception handling request to /home/index.php?q=: com.caucho.quercus.QuercusModuleException: java.io.IOException:

       

      An existing connection was forcibly closed by the remote host

       

      Please help me out to resolve this issues.

        • 1. Re: Application runs into a Redirect Loop error WildFly8
          tailorbird indian Newbie

          my web.xml:


          <servlet-mapping>
            
          <servlet-name>Quercus Servlet</servlet-name>
            
          <url-pattern>*.php</url-pattern>
          </servlet-mapping>

          <welcome-file-list>
            
          <welcome-file>index.php</welcome-file>
          </welcome-file-list>

          • 2. Re: Application runs into a Redirect Loop error WildFly8
            Stuart Douglas Master

            Your rewrite rule is not equivalent. It should be something like:

             

            regex['/home/(.*)$'] -> rewrite['/home/index.php?q=${1}']

            • 3. Re: Application runs into a Redirect Loop error WildFly8
              tailorbird indian Newbie

              Hello Stuart,

              I tried this. But it didn't work. It seems, page is still running in to a redirect loop and was throwing the following error.

               

              :05:46,791 ERROR [io.undertow.request] (default task-43) UT005023: Exception handling request to /home/index.php?q=: com.caucho.quercus.QuercusModuleException: java.io.IOException: An established co

                    at com.caucho.quercus.env.Env.write(Env.java:1480) [resin.jar:4.0.35]

                    at com.caucho.quercus.env.StringBuilderValue.print(StringBuilderValue.java:1644) [resin.jar:4.0.35]

                    at com.caucho.quercus.lib.string.StringModule.print(StringModule.java:1496) [resin.jar:4.0.35]

                    at sun.reflect.GeneratedMethodAccessor216.invoke(Unknown Source) [:1.7.0_80]

                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_80]

                    at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_80]

                    at com.caucho.quercus.module.StaticFunction.invoke(StaticFunction.java:113) [resin.jar:4.0.35]

                    at com.caucho.quercus.env.JavaInvoker.callJavaMethod(JavaInvoker.java:814) [resin.jar:4.0.35]

                    at com.caucho.quercus.env.JavaInvoker.callMethod(JavaInvoker.java:690) [resin.jar:4.0.35]

                    at com.caucho.quercus.env.JavaInvoker.call(JavaInvoker.java:671) [resin.jar:4.0.35]

                    at com.caucho.quercus.expr.CallExpr.evalImpl(CallExpr.java:239) [resin.jar:4.0.35]

                    at com.caucho.quercus.expr.CallExpr.eval(CallExpr.java:151) [resin.jar:4.0.35]

                    at com.caucho.quercus.expr.Expr.evalTop(Expr.java:540) [resin.jar:4.0.35]

                    at com.caucho.quercus.statement.ExprStatement.execute(ExprStatement.java:67) [resin.jar:4.0.35]

                    at com.caucho.quercus.statement.IfStatement.execute(IfStatement.java:84) [resin.jar:4.0.35]

                    at com.caucho.quercus.statement.IfStatement.execute(IfStatement.java:87) [resin.jar:4.0.35]

                    at com.caucho.quercus.statement.BlockStatement.execute(BlockStatement.java:105) [resin.jar:4.0.35]

                    at com.caucho.quercus.program.QuercusProgram.execute(QuercusProgram.java:414) [resin.jar:4.0.35]

                    at com.caucho.quercus.page.InterpretedPage.execute(InterpretedPage.java:90) [resin.jar:4.0.35]

                    at com.caucho.quercus.env.Env.executePageTop(Env.java:4293) [resin.jar:4.0.35]

                    at com.caucho.quercus.env.Env.executeTop(Env.java:4236) [resin.jar:4.0.35]

                    at com.caucho.quercus.servlet.QuercusServletImpl.service(QuercusServletImpl.java:202) [resin.jar:4.0.35]

                    at com.caucho.quercus.servlet.QuercusServlet.service(QuercusServlet.java:568) [resin.jar:4.0.35]

                    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]

                    at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]

                    at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]

                    at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]

                    at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)

                    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]

                    at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]

                    at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]

                    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]

                    at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.1.0.Final.jar:1.1.0.Final]

                    at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:63) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]

                    at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58) [undertow-core-1.1.0.Final.jar:1.1.0.Final]

                    at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]

                    at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) [undertow-core-1.1.0.Final.jar:1.1.0.Final]

                    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]

                    at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)

                    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]

                    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]

                    at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:261) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]

                    at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:247) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]

                    at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:76) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]

                    at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:166) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]

                    at io.undertow.server.Connectors.executeRootHandler(Connectors.java:197) [undertow-core-1.1.0.Final.jar:1.1.0.Final]

                    at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:759) [undertow-core-1.1.0.Final.jar:1.1.0.Final]

                    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_80]

                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_80]

                    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_80]

              used by: java.io.IOException: An established connection was aborted by the software in your host machine

                    at sun.nio.ch.SocketDispatcher.writev0(Native Method) [rt.jar:1.7.0_80]

                    at sun.nio.ch.SocketDispatcher.writev(SocketDispatcher.java:55) [rt.jar:1.7.0_80]

                    at sun.nio.ch.IOUtil.write(IOUtil.java:148) [rt.jar:1.7.0_80]

                    at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:529) [rt.jar:1.7.0_80]

                    at org.xnio.nio.NioSocketConduit.write(NioSocketConduit.java:161)

                    at io.undertow.server.protocol.http.HttpResponseConduit.write(HttpResponseConduit.java:609) [undertow-core-1.1.0.Final.jar:1.1.0.Final]

                    at io.undertow.conduits.ChunkedStreamSinkConduit.doWrite(ChunkedStreamSinkConduit.java:162) [undertow-core-1.1.0.Final.jar:1.1.0.Final]

                    at io.undertow.conduits.ChunkedStreamSinkConduit.write(ChunkedStreamSinkConduit.java:126) [undertow-core-1.1.0.Final.jar:1.1.0.Final]

                    at io.undertow.conduits.ChunkedStreamSinkConduit.write(ChunkedStreamSinkConduit.java:209) [undertow-core-1.1.0.Final.jar:1.1.0.Final]

                    at org.xnio.conduits.ConduitStreamSinkChannel.write(ConduitStreamSinkChannel.java:158)

                    at io.undertow.channels.DetachableStreamSinkChannel.write(DetachableStreamSinkChannel.java:178) [undertow-core-1.1.0.Final.jar:1.1.0.Final]

                    at io.undertow.server.HttpServerExchange$WriteDispatchChannel.write(HttpServerExchange.java:1815) [undertow-core-1.1.0.Final.jar:1.1.0.Final]