Project

General

Profile

Mod setenv » History » Revision 9

Revision 8 (Anonymous, 2008-07-29 18:51) → Revision 9/30 (zkv, 2008-11-23 17:20)

h1. [[TracNav(DocsToc)]] 

 <pre> 

 #!rst 
 =========================== 
 Conditional Request Headers 
 =========================== 

 *Module: mod_setenv* ------------------ 
 Module: mod_setenv 
 ------------------ 

 h2. .. meta:: 
   :keywords: lighttpd, skeleton 
  
 .. contents:: Table of Contents 

 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: 

 <pre> :: 

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

 </pre> 

 h2. 


 Options 
 ======= 

 *setenv.add-environment* 
 Adds setenv.add-environment 
   adds a value to the process environment that is passed to the external applications: 

 <pre> applications :: 

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

 </pre> 

 *setenv.add-response-header* 
 Adds setenv.add-response-header 
   adds a header to the HTTP response sent to the client: 
 
 <pre> 

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

 </pre> 

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

 <pre> 

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

 
 </pre>