Cherokee Web Server: Request configuration

Request configuration

The Request entry provides a powerful way to apply custom options to requests. It is a complement for the Directory and Extension entries. Basically, there are two differences between them:


Examples

CGI with parameter

Request "^/cgi-bin/example.pl\?op=modify.*" {
    Allow From 127.0.0.1
}

It will only allow to call the example.pl with the modify value in its first parameter op if the connections comes from localhost.


Joining pyshical directories in a virtual one

Directory /downloads {
    Handler file
}

Request "/downloads/.*\.iso" {
    DocumentRoot /mnt/bigdisk/isos/
}

It is a nice trick. Let's imagine the virtual server document root is /var/www. The request of http://example.com/downloads/file.zip will access to /var/www/downloads/file.zip, but the request of http://example.com/downloads/debian.iso will access /mnt/bigdisk/isos/debian.iso.