[users@httpd] % mod_proxy URL issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Chris

Insert this right before your "front-end" Proxy* directives in
httpd.conf.
# 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.)
#!/bin/bash

LOGFILE=/tmp/percent_rewrite.log
cat /dev/null > $LOGFILE

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

done

---
Chris Covington
IT
Plus One Health Management
75 Maiden Lane Suite 801
NY, NY 10038
646-312-6269
http://www.plusoneactive.com


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux