Tomcat 7 adds jsessionid in request-URI as opposed to Tomcat 5
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Javed_Attar
Posted On:   Thursday, August 4, 2011 04:41 AM

I was using Tomcat 5.0.28 before using Tomcat 7. The application was working perfectly fine. Recently, we have migrated from Tomcat 5 to Tomcat 7. The application works fine for most of the part but gives problem with URLRewriteFilter. I have used URLRewriteFilter to convert Capital case request URI to lowercase and SEO purpose. The capital case convert rule looks like Force URL filenames to lower case Redirect rule to convert capital case URLs to small case with parameters ^/.*[A-Z].* ^/(.*)?.* %{context-path}/${lower:$1}?%{query-string} when this r   More>>

I was using Tomcat 5.0.28 before using Tomcat 7.
The application was working perfectly fine. Recently, we have migrated from Tomcat 5 to Tomcat 7.



The application works fine for most of the part but gives problem with URLRewriteFilter.


I have used URLRewriteFilter to convert Capital case request URI to lowercase and SEO purpose.


The capital case convert rule looks like





Force URL filenames to lower case

Redirect rule to convert capital case URLs to small case with parameters

^/.*[A-Z].*

^/(.*)?.*

%{context-path}/${lower:$1}?%{query-string}






when this rule processed in Tomcat 5, it is processed against request URI "/XXXX/yyyyy/zzzzzz" (excluding quotes) where part of request URI is in capital case i.e. XXXX



During redirect URL is encoded which appends jsessionid.
The redirected URL looks like

/xxxx/yyyyy/zzzzzz;jessionid=A226083725B7B955569D86710420D1DF



When browser calls above URL after redirect the new request is processed. Now the request URI becomes

"/xxxx/yyyyy/zzzzzz"



so it will not go to capital case rule and will be processed against SEO rules.




In Tomcat 7 if I try the same URL which has request URI i.e. "/XXXX/yyyyy/zzzzzz" (excluding quotes) where part of request URI is in capital case i.e. XXXX



During redirect URL is encoded which appends jsessionid.
The redirected URL looks like

/xxxx/yyyyy/zzzzzz;jessionid=BCE91A85A66AAFF384E854D59E5AC877




When browser calls above URL after redirect the new request is processed. Now the request URI becomes

/xxxx/yyyyy/zzzzzz;jessionid=BCE91A85A66AAFF384E854D59E5AC877



Here it breaks for me on Tomcat 7

The jsessionid is part of request URI. Hence it again goes to capital case rule which it shouldn't. Then again same thing happens and new jsessionid is appended to URL as shown in following URI



/xxxx/yyyyy/zzzzzz;jsessionid=bce91a85a66aaff384e854d59e5ac877;jsessionid=BCE91A85A66AAFF384E854D59E5AC877



This goes on happening in infinite loop and browser throws error "Page isn't redirecting properly"



Can anybody tell me what feature/change in Tomcat 7 responsible for this behavior?


I will really appreciate any help on this.

Thanks in advance.



-Javed Attar

   <<Less
About | Sitemap | Contact