Project

General

Profile

Actions

Mod setenv » History » Revision 15

« Previous | Revision 15/30 (diff) | Next »
Olaf-van-der-Spek, 2019-04-27 07:49


Conditional Request Headers

Module: mod_setenv

Description

The setenv module allows influencing the environment external applications are spawned in and the response headers the server sends to the clients.

Automatic Decompression

If you have a lot text-files compressed with gzip on disk and want that the browser is decompressing them on retrieval you can use setenv to inject the Content-Encoding header:


  $HTTP["url"] =~ "(README|ChangeLog|\.txt)\.gz$" {
    setenv.add-response-header  = ( "Content-Encoding" => "gzip")
    mimetype.assign = ("" => "text/plain" )
  }

Options

setenv.add-environment
Adds a value to the process environment (aka environment variables) that is passed to the external applications:


    setenv.add-environment = ( 
      "TRAC_ENV" => "lighttpd",
      "RAILS_ENV" => "production" 
    )

setenv.add-response-header
Adds a header to the HTTP response sent to the client:


    setenv.add-response-header = (
      "Content-Encoding" => "gzip" 
    )

setenv.add-request-header
Adds a header to the HTTP request that was received from the client:


    setenv.add-request-header = (
      "X-Proxy" => server.name
    )

setenv.set-request-header (since 1.4.46)
setenv.set-response-header (since 1.4.46)
setenv.set-environment (since 1.4.46)
These directives set the given values, rather than appending the given values to the headers or environment. These directives take precedence over the setenv.add-* counterparts. Set a blank value for request or response header to remove the header.

Updated by Olaf-van-der-Spek over 5 years ago · 15 revisions