httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Covington, Chris" <>
Subject [users@httpd] % mod_proxy URL issue
Date Thu, 29 Sep 2005 20:15:01 GMT
Is it possible to have a mod_rewrite rule which will rewrite a % with a
%25?  Below is a hack for Outlook Web Access which, when
reverse-proxied, apache2 chokes on when a % is in a subject of an email
(and thus in the URL) unless the following is done.


Insert this right before your "front-end" Proxy* directives in
# Using mod_rewrite to fix a problem when percent symbols are in
# the subject line of the OWA email (the email subject is used
# in the web query - WTF?). The entire URI is passed to a small
# bash script I wrote that replaces all occurrences of the % symbol
# with the URI escape sequence (%25). That seems to make everything
# happy.
RewriteEngine On
RewriteMap damnpercent prg:/usr/local/bin/percent_rewrite
RewriteCond $1 ^/exchange/.*\%.*$
RewriteRule (/exchange/.*) ${damnpercent:$1} [P]

The simple bash script uses sed to work its magic. You'll notice I am
also sending the original and changed URL to a log file in /tmp. This
helps with troubleshooting and can be shut off when you're confidant
everything is working. (This could easily be rewritten in any language.)

cat /dev/null > $LOGFILE

while read URL
NEWURL=$(echo "$URL" | sed -e "s/%/%25/g")
echo "Changing $URL to $NEWURL" >> $LOGFILE
echo $NEWURL


Chris Covington
Plus One Health Management
75 Maiden Lane Suite 801
NY, NY 10038

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message