-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Tero,
On 1/11/2010 8:41 AM, Tero Karttunen wrote: > [snip] > RedirectMatch ^/sites(.*)$ /contextroot/subcontext/sites$1 [snip] > OBSERVED BEHAVIOR WITH +ForwardURIProxy: (implicit) > ===================================== > I try to access URL http://localhost/sites/one%2Bone%3Cthree with > Internet Explorer browser. > Apache HTTPD access log: > 131.177.146.160 [11/Jan/2010:12:42:49 +0200] "GET > /sites/one%2Bone%3Cthree HTTP/1.1" +302 -(-) 263 0 > 131.177.146.160 [11/Jan/2010:12:42:49 +0200] "GET > /contextroot/subcontext/sites/one+one%3cthree HTTP/1.1" +200 > worker2(worker2) 399 0 As you surmised, the RedirectMatch appears to be breaking your URI: %2B - -> + instead of %2B -> %2B. > Notice that mod_alias has erronously (considering the use case in > question) re-encoded the URL, causing %2B to change into '+' and %3C > to change into equivalent %3c. Note that mod_jk is not involved, here: mod_alias is performing the redirect and mod_jk does not get involved. Also, the change from %3C to %3c is not really a problem: HTTP allows either upper or lowercase %-encoded URI elements (see section 2.2 of http://www.ietf.org/rfc/rfc1738.txt). > Now, if I manually modify the address bar to access > http://localhost/contextroot/subcontext/sites/one%2Bone%3Cfour, > Apache HTTPD access log now shows: > 131.177.146.160 [11/Jan/2010:12:53:37 +0200] "GET > /ts_core_virtual_repository/TeamCenterEmulator/sites/one%2Bone%3Cfour > HTTP/1.1" +200 worker1(worker1) 399 15625 Good. > but Tomcat access log still shows: > 131.177.146.160 - - [11/Jan/2010:12:53:34 +0200] "GET > /ts_core_virtual_repository/TeamCenterEmulator/sites/one+one%3Cfour > HTTP/1.1" 200 399 Right: that's wrong. > and my application sees after decoding the URL: sites/one one<four Given that Tomcat saw one+one%3Cfour, this is correct decoding. What does the mod_jk log show for this request? > Quite interesting: No URL rewriting should occur at Apache HTTPD, > because the RedirectMatch rule does not match, but the URLs in HTTPD > and Tomcat access logs are semantically different. Well, the RedirectMatch rule does match for the first request, and it definitely appears that mod_alias is mangling your URL. Have you tried snooping the HTTP conversation to make sure it's not your web browser that is misinterpreting the 302 response from httpd? > Now, I again manually modify the address bar to access > http://localhost/contextroot/subcontext/sites/one%2Bone%3Csix. This > time, > Apache HTTPD access log shows: > 131.177.146.160 [11/Jan/2010:13:00:20 +0200] "GET > /contextroot/subcontext/sites/one%2Bone%3csix HTTP/1.1" +200 > worker1(worker1) 399 15625 > and Tomcat access log shows: > 131.177.146.160 - - [11/Jan/2010:13:00:18 +0200] "GET > /contextroot/subcontext/sites/one%2Bone%3csix HTTP/1.1" 200 399 > This time my application sees the intended request after decoding the > URL: sites/one+one<six This all looks correct. When your web browser sends a correct URI, your webapp sees the correct URI. I would leave +ForwardURICompatUnparsed enabled for mod_jk. > JkOption ForwardURICompatUnparsed seem to offer a workaround for this > problem for the load balancer, but the solution has its own problems > (incompability with mod_rewrite among other things, although that does > not seem to apply to browser redirects). I have not found a similar > workaround for mod_alias yet. You aren't using mod_rewrite, so such incompatibilities should not be a problem. > How should I change my configuration so that > http://localhost/sites/one%2Bone%3Cthree gives the same same results > as http://localhost:8082/contextroot/subcontext/sites/one%2Bone%3Cthree? - From your observations, I would expect that this is either a bug in mod_alias (%2B -> +) or in your web browser. Only reading the HTTP traffic will tell you which it is. Good luck, - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAktM4VQACgkQ9CaO5/Lv0PCdhACeIHMjqzMTxiOLC7h8fv7bnTl7 j6AAoI5h0SSglg1zfQ3588H4J8Ey8PsD =Ike1 -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org