Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Application runs into a Redirect Loop error WildFly8

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 and this 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.

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>
like image 791
Nidheesh Avatar asked Jul 15 '15 04:07

Nidheesh


1 Answers

The undertow equivalent to the rewrite conditions would be:

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

And I'm pretty sure the exception is not related to the regex itself.

like image 97
Grasshopper Avatar answered Nov 29 '22 16:11

Grasshopper