How to dynamically set HTTP Header in Apache 2.2?

Posted by Michael on Server Fault See other posts from Server Fault or by Michael
Published on 2009-12-13T00:57:16Z Indexed on 2010/04/29 10:07 UTC
Read the original article Hit count: 276

Filed under:
|
|

Seems like this should be easy, but I cannot figure out the syntax. In Apache, I want to use the value of an existing request header to set a new request header. Some simple non-working code that illustrates what I'd like to do:

RequestHeader set X-Custom-Host-Header "%{HTTP_HOST}e"

Ideally, this would make a new HTTP header in the request called "X-Custom-Host-Header" that contains the value of the existing Host header. But it does not. Perhaps I need to copy the existing header into an environment variable first? (If so, I can't figure out how to do that either.)

I feel like I'm missing something obvious, but I've gone over the Apache docs and I can't figure it out. Thanks for any help.

© Server Fault or respective owner

Related posts about apache

Related posts about request