Author: | Olivier Dupuis |
---|---|
Date: | 2012-08-23 |
Version: | 0.9 |
Manual section: | 3 |
import condhdr; condhdr.set(<string to test>,<regexp for test>,<header field name>,<header field value>)
Implements conditionnal (regexp driven) setting of http header field and value. Useful when Varnish is used to set the Cache-Control headers in that case you would have many :
- if (bereq.url ~ "/^/path/*.html"){
- beresp.http.Cache-Control="max-age=30s";
}
it allows more compact configuration file If more than one condhdr.set is matched by string, the last one overrides the others
Thanks : mutex lock taken from : libvmod-header https://github.com/varnish/libvmod-header/
Example VCL:: backend foo { ... };
import condhdr;
- sub vcl_fetch {
- condhdr.set(bereq.url,"^/path/*.html","Cache-Control","max-age=30s");
}
- Prototype
- condhdr.set(<string to test>,<regexp for test>,<header field name>,<header field value>)
- Returns
- void