Apache Tomcat does a 302 redirect to default page

BlueDragon and Railo , WEBBY STUFF Add comments

I have just migrated a client site from CF to their own dedicated VPS running Railo on Apache Tomcat.

One of the issues that arose as a result is that when visiting their site auctionnews.co.uk an automatic 302 redirect occurred redirecting to auctionnews.co.uk/default.cfm which is the default page for the site.

 

Now I knew this was not IIS so it had to be Apache Tomcat causing it, after Googling I found numerous other people with this issue but no solution. The only suggestions I found seemed madly over the top, like re-compiling the Tomcat source with new directives to creating a custom servlet.

 

I then just took a step back and thought there must be a simple solution, and remembered that Tomcat has its own set of default files and wondered if this might have something to do with it. I checked the web.xml and of course default.cfm was not in the list as this is not a common default file, so I surmised that Tomcat must be getting the default filename sent to it from IIS and was thus redirecting to it, so perhaps simply adding default.cfm to the <welcome-file-list> might resolve the issue.

Eureka I was right, adding <welcome-file>default.cfm</welcome-file> to the m<welcome-file-list> resolved the issue and no more redirects.

 

So to summarise, if your default document is only set on the webserver it gets passed to Tomcat which does a redirect. If the default document is specified in Tomcat's <welcome-file-list> it will simply forward to that document with no redirect.

 

Considering the lack of Google results on this topic hopefully this simple solution might stop others tearing their hair out Smile

0 responses to “Apache Tomcat does a 302 redirect to default page”

Leave a Reply

Leave this field empty

Powered by Mango Blog. Design and Icons by N.Design Studio