Mod setenv » History » Revision 13

Revision 12 (simmel, 2012-08-11 10:42) → Revision 13/30 (gstrauss, 2017-02-27 05:36)

h1. Conditional Request Headers 


 *Module: mod_setenv* 

 h2. Description 

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

 h2. Automatic Decompression 

 If you have a lot text-files compressed with gzip on disk and want that the browser is decompressing them on retrival 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" ) 


 h2. Options 

 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" 


 Adds a header to the HTTP response sent to the client: 

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


 Adds a header to the HTTP request that was received from the client: client :: 


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


 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.