Commit ecf54e70 authored by Lasse Karstensen's avatar Lasse Karstensen

Add markers for 065

parent 210e0352
varnishtest "Test varnish-devicedetect"
server s1 {
rxreq
txresp
} -start
# this example shows how to normalize the user agent string seen by the backend.
varnish v1 -vcl+backend {
include "${projectdir}/../devicedetect.vcl";
sub vcl_recv {
call devicedetect;
if (req.http.X-UA-Device ~ "^mobile" || req.http.X-UA-device ~ "^tablet") {
error 750 "Moved Temporarily";
}
}
sub vcl_error {
if (obj.status == 750) {
set obj.http.Location = "http://m.example.com" + req.url;
set obj.status = 302;
return(deliver);
}
}
} -start
client c1 {
txreq -req GET -url /foo -hdr "User-Agent: Mozilla/5.0 (Linux; U; Android 2.2; nb-no; HTC Desire Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"
rxresp
expect resp.status == 302
expect resp.http.Location == "http://m.example.com/foo"
}
client c2 {
txreq -req GET -url /foo
rxresp
expect resp.status == 200
expect resp.http.Location != "http://m.example.com/foo"
}
client c1 -run
client c2 -run
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment