Manipulating Headers


Header set header-name header-value


You can pass additional information to a backend server using the Header directive, provided by the mod_headers module. This module can be used to add and remove arbitrary headers in HTTP requests and responses.

You can add a response HTTP header, deleting any other HTTP headers with the same name that might be present by using Header set, as shown in the example. If you want to add a new header instead of replacing an existing one, you can use Header add instead of Header set. If you want to append the value to an existing header, remove certain headers, or add a request header to the response, you can use append, unset, and echo respectively.

You can modify the request headers sent to the client by using RequestHeader instead of Header. You can add the content of environment variables to the header-value argument by using the format string %{variablename}e. This is similar to how the LogFormat directive works, as explained in Chapter 3, "Logs and Monitoring." For example, you can use this to pass information about an SSL connection and certificates to the backend server. For that, you will need first to tell mod_ssl to store this information in environment variables with SSLOptions +StdEnvVars. Starting with Apache 2.1, you can avoid that step and access SSL environment variables directly with %{variable-name}s.




Apache(c) Phrase Book(c) Essential Code and Commands
Apache Phrasebook
ISBN: 0672328364
EAN: 2147483647
Year: 2006
Pages: 254

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net