Antw: Re: [users@httpd] Rewriting headers

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

 



Good morning Brian,

thanks for your reply. Did I understand your explanation correctly?

  1. Request comes in
  2. Request is not considered as proxy request and hence initially not handled by mod_proxy
  3. Request is caught by mod_rewrite
  4. mod_rewrite parses the headers, retrieves the values in question by regex and stores them in environment variables
  5. mod_headers modifies the headers upon the env-vars
  6. Apache reverse proxies the request with the modified headers to the static upstream server through mod_write and the bottom RewriteRule

Thank you,
Alexander


>>> brianvh@xxxxxxxxxxxxxxxxxx 20.05.2005 18:10:27 >>>

Yes. This is what the mod_rewrite module is for. What you need to do is 
not use mod_proxy directly (i.e. ProxyPass), but do your reverse proxy 
handling through mod_rewrite (the [P] flag for RewriteRule). That way, 
you can use mod_rewrite to grab an HTTP header value and place it into 
an environment variable. That would allow you to access that value via 
mod_headers, before you go back to mod_rewrite to do the reverse proxy 
call.

Here's an example...

     RewriteEngine on

     # Get the custom header value and store in a temporary environment 
variable
     RewriteCond %{HTTP:X-Custom-Header-Name} (.*)
     RewriteRule .* - [E=FOO_HEADER:%1]

     # We need the FOO_HEADER on the proxy side of things, so we grab 
the value from the temp
     # variable and add it as a new HTTP header for the upcoming proxy 
request
     RequestHeader add X-My-FOO %{FOO_HEADER}e

     # Send our request to the proxy location
     RewriteRule ^/(.*)$ http://127.0.0.1:8080/$1 [P,L]

-Brian


---------------------------------------------------------------------
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 



---------------------------------------------------------------------
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