tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Bremford" <>
Subject Solution (kindof) - mod_rewrite not working
Date Thu, 07 Sep 2000 19:13:27 GMT
Hi guys - can someone who's also signed up to tomcat-dev forward this on to
that list?

There's been a long standing problem when using Apache+mod_rewrite with
tomcat - Tomcat always seemed to pick up the URL before it was rewritten,
not after.

Anyway, the following change to worked for me. I
won't send a patch, as it's a single line that needs changing - the one
listed below starting with "requestURI". Previously this string was assigned
to "dummy", which was a shame as it contained the rewritten URI. If rewrite
isn't used, it contains the same value as the original URI requested.

I have no idea if this is 100% correct or if it will cause problems further
down the line or in a different area, but it works for me. Please consider
including it, or something like it, in the next 3.2 beta, as this has popped
up a lot on the tomcat-user mailing list, and it's been doing my head in for
weeks :-)

If any brave souls who have staked their site on mod_rewrite only to find it
didn't work (like me!) want to take a chance, I've build a jar file and put
it online at This is basically a
stock 3.2b3 webserver.jar file with this single line changed - overwrite the
file in /usr/local/jakarta-tomcat/lib with this. Obviously there's a
significant chance that I messed up big time, so use at your own risk.

Note this doesn't conflict with the patch sent in 2000-09-06 by (BugRat #64) - I tried that one first, it
didn't fix our problem.

The version I'm using is 3.2b3. Here's the change.

// XXX don't set lookup path - problems with URL rewriting.
// need to be fixed.
//          if(contextPath!=null && contextPath.length() >0 )
//              lookupPath=requestURI.substring( contextPath.length() + 1 );
if( doLog ) log("AJP: URI: " + requestURI + " CP:" + contextPath + " LP: " +
dummy = ajpin.readString(null);                   //script filename
//          System.out.println("AJP: Script filen=" + dummy);

requestURI = ajpin.readString(null);                   //script name  <<<<<
//          System.out.println("AJP: Script name=" + dummy);

Hope someone finds it useful. Please let me know if I've cocked it up
somehow, as it's going into production in a couple of weeks come hell or
high water.

Cheers... Mike

View raw message