This took me a while to figure out, so I wanted to share it:

Requirement: before reaching the application, Apache should rewrite a
header like:

MSISDN: 192.168.0.1 639285020062

to:

XX-MSISDN: 639285020062


Solution:

# Request headers
<IfModule !mod_headers.c>
 LoadModule headers_module modules/mod_headers.so
</IfModule>

# Copy the MSISDN to an internal variable
RewriteEngine On
RewriteCond %{HTTP:MSISDN} .*\s(.*)
RewriteRule .* - [E=MSISDN:%1]

# Set the XX-MSISDN header
RequestHeader set XX-MSISDN %{MSISDN}e
_________________________________________________
Philippine Linux Users' Group (PLUG) Mailing List
plug@lists.linux.org.ph (#PLUG @ irc.free.net.ph)
Read the Guidelines: http://linux.org.ph/lists
Searchable Archives: http://archives.free.net.ph

Reply via email to