We need to unset environment variables from RewriteRules. Attached is a patch against -trunk to do this. Example: Configuration: RewriteEngine on LogLevel rewrite:trace5 RewriteRule ^ - [E=pling:plong] RewriteRule ^ - [E=foo:boo,E=!pling] Test: $ GET http://localhost:8000/cgi-bin/printenv | egrep '(foo|pling)' foo="boo" Log: [Mon Jun 28 16:44:43.364112 2010] [trace2] [pid 516:tid 1153177920] mod_rewrite.c(447): [client 127.0.0.1:44518] 127.0.0.1 - - [localhost/sid#d5c9af8][rid#d6f4680/initial] init rewrite engine with requested uri /cgi-bin/printenv\n [Mon Jun 28 16:44:43.364157 2010] [trace3] [pid 516:tid 1153177920] mod_rewrite.c(447): [client 127.0.0.1:44518] 127.0.0.1 - - [localhost/sid#d5c9af8][rid#d6f4680/initial] applying pattern '^' to uri '/cgi-bin/printenv'\n [Mon Jun 28 16:44:43.364177 2010] [trace5] [pid 516:tid 1153177920] mod_rewrite.c(447): [client 127.0.0.1:44518] 127.0.0.1 - - [localhost/sid#d5c9af8][rid#d6f4680/initial] setting env variable 'pling' to 'plong'\n [Mon Jun 28 16:44:43.364187 2010] [trace3] [pid 516:tid 1153177920] mod_rewrite.c(447): [client 127.0.0.1:44518] 127.0.0.1 - - [localhost/sid#d5c9af8][rid#d6f4680/initial] applying pattern '^' to uri '/cgi-bin/printenv'\n [Mon Jun 28 16:44:43.364197 2010] [trace5] [pid 516:tid 1153177920] mod_rewrite.c(447): [client 127.0.0.1:44518] 127.0.0.1 - - [localhost/sid#d5c9af8][rid#d6f4680/initial] setting env variable 'foo' to 'boo'\n [Mon Jun 28 16:44:43.364207 2010] [trace5] [pid 516:tid 1153177920] mod_rewrite.c(447): [client 127.0.0.1:44518] 127.0.0.1 - - [localhost/sid#d5c9af8][rid#d6f4680/initial] unsetting env variable 'pling'\n [Mon Jun 28 16:44:43.364216 2010] [trace1] [pid 516:tid 1153177920] mod_rewrite.c(447): [client 127.0.0.1:44518] 127.0.0.1 - - [localhost/sid#d5c9af8][rid#d6f4680/initial] pass through /cgi-bin/printenv\n Obviously this'll be a problem for anyone who is setting environment variables with names starting with !. Hopefully this is uncommon.
Created attachment 25648 [details] Unset env vars from RewriteRule
Created attachment 25649 [details] Unset env vars from RewriteRule New patch -- previous was reversed.
Commited with some tweaks to trunk in r1053726
fixed in 2.4.1 and 2.2.20