• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Tomcat 5.5.9 Redirect /index.jsp to /

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Using Tomcat 5.5.9

I have a client requirement to redirect all requests to '/index.jsp' to '/'

In index.jsp, I added: response.sendRedirect("http://www.sitename.com/");

Since the welcome-file points to index.jsp, this becomes impossible because of an infinite loop.

So, I changed the welcome-file entry to 'main.jsp' and copied all of the 'content' from index.jsp into main.jsp. In index.jsp, I put the redirect to "http://www.sitename.com/".

Theoretically, all requests coming for /index.jsp should redirect to / and the default Tomcat servlet should include the contents of 'main.jsp'. There are no redirects in main.jsp, just content.

This should work, however it isn't. I have an infinite loop of redirects occuring. I changed the welcome-file in /conf/web.xml and the apps WEB-INF/web.xml. I also didn't forget to restart tomcat.

PS, I also tried using .htaccess, that doesn't work because Tomcat is serving the page and not Apache.

Any thoughts on this ridiculous (but very important to me) matter?

Why is Tomcat not using the welcome-file that points to main.jsp?
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you using Apache HTTPD with a connector?
If so, could it be that httpd is serving up index.jsp when you redirect to www.sitename.com from Tomcat?
 
Justin Krettabull
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We are using Apache mod_jk connector.

We have an Apache mapping for *.jsp to automatically forward to Tomcat.
 
Justin Krettabull
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This issue is resolved.

My welcome-file in web.xml was being overridden by Apache's welcome-file.
 
You have to be odd to be #1 - Seuss. An odd little ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic