URLRewriteFilter Servlet Filter problem in WebSphere 6.1.0.5

I recently wrote up an article on SEO Friendly URL’s for J2EE frameworks, while my tomcat implementations and WebSphere 5.1 implementations of the URLRewriteFilter were seemless, I ran into a problem on WebSphere 6.1 that caused me to rack my brain. The Output urls in the page were being rewritten fine, which is usually a gotcha if you forgot to response.encodeURL, but none of the inbound rules seemed to be rewriting back to the original url. In fact I was receiving a big fat 404 error and nothing in the console indicating that the URLRewrite Servlet Filter was even being invoked. After several hours of Googling, I found that the guys over at Atlassian had run into the same problem with their products Jira and Confluence.

Apparently IBM made a change in 6.1.0.5 that is causing this problem:

WebSphere 6.1.0.5 and above checks if a URL is mapped to a servlet or a file before it puts a request through the filter chain. As we do not have a servlet or a file that is mapped to a URL:

http:///a/AZ/

WebSphere 6.1.0.5 sends a 404 to the user before giving the UrlRewrite filter a chance to redirect a URL to the correct place.

To make the filter invoke on a request without a servlet mapping you should be able to do the following in the WebSphere Admin Console:

- expand Servers -> Application Servers -> <server> -> Web Container Settings -> Web Container -> Custom Properties
- select New and then enter "com.ibm.ws.webcontainer.invokefilterscompatibility" as the property name and "true" as the value
- save the update and restart the server

Hopefully this explanation helps the WebSphere community with their SEO strategies by letting them rewrite their urls.

Comments

  • Shupa 3:20 am on August 14, 2008

    Hello,

    Thanks thanks thanks !!!!

    We got the same problem of a new installation on your was application in 6.1.0.7
    2 days to find the solution :s

Leave a Comment