Accessing req and resp header values
Alexander
alex.taggart at gmail.com
Thu Jun 5 01:38:46 CEST 2008
I am trying to implement a bit of logic to change the Content-Type of the
response, but part of the logic requires knowing the User-agent, which is in the
request.
Example:
sub vcl_deliver {
if (req.http.User-Agent ~ "MSIE 6"
&& resp.http.Content-Type ~ "application/xhtml+xml") {
set resp.http.Content-Type = "text/html";
}
deliver;
}
Result:
Variable 'req.http.User-Agent' not accessible in method 'vcl_deliver'
I haven't found any documentation stating what variables are available in which
functions, but so far I haven't been able to figure out any way of doing this
short of messing with the hash and having unnecessary duplicates in the cache.
Any suggestions?
More information about the varnish-misc
mailing list