Sunday, May 24, 2009

Case sensitivity in Tomcat - sort of solved for IIS isapi_redirector

Basically, the problem is that URLs are defined to be case sensitive, but no-one thinks of them that way. Everyone expects:

www.mysite.com/GeoServer/

to act the same as

www.mysite.com/geoserver/

when in fact, this should not be. Tomcat acts in a case sensitive fashion, according the the spec. So, to make this conform not to spec, but to peoples expectations, we would like Tomcat to be a little less case sensitive, at least in the first level of the URI.

One way to do this is using the Rewrite Rule file in the isapi_redirect.properties file that controls the behavior of the isapi_redirect filter. Add this:


#rewrite rule file to get rid of the problems with case sensitivity
rewrite_rule_file=D:\OGI\Programs\Tomcat\Tomcat 6.0\conf\rewrite_rule_file.properties

to point to a rewrite_rule_file.properties file which contains:

# Simple rewrite rules,making the top level of the uri less case sensitive.
/geoserver=/GeoServer
/GEOSERVER=/GeoServer
/Geoserver=/GeoServer

Note: the rewriting happens AFTER the match in uriworkermap.properties, so change uriworkermap.properties to contain:

/examples/*=worker1
/GeoServer/*=worker1
/geoserver/*=worker1
/GEOSERVER/*=worker1
/Geoserver/*=worker1

Restart IIS, and then typing in any of the following will work:
www.mysite.com/GeoServer/
www.mysite.com/geoserver/
www.mysite.com/GEOSERVER/
www.mysite.com/Geoserver/

Now, the rest of the urls are still case sensitive, and I'm leaving them that way in case there is some reason for this way down in the bowels of GeoServer.

No comments:

Post a Comment