Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-devicedetect
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-devicedetect
Commits
8b35e6c4
Commit
8b35e6c4
authored
Jan 15, 2013
by
Lasse Karstensen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reindent according to Varnish coding standards.
Thanks to Sergey Syrota for pointing this out.
parent
516c887d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
20 deletions
+25
-20
devicedetect-dev.vcl
devicedetect-dev.vcl
+25
-20
No files found.
devicedetect-dev.vcl
View file @
8b35e6c4
...
...
@@ -5,31 +5,36 @@
#
backend devicetest {
.host = "127.0.0.1";
.port = "5911";
.host = "127.0.0.1";
.port = "5911";
}
sub vcl_recv {
# 701/702 are arbitrary chosen return codes that is only used internally in varnish.
if (req.url ~ "^/set_ua_device/.+") { error 701 regsub(req.url, "^/set_ua_device/", ""); }
# set expired cookie if nothing is specified
if (req.url ~ "^/set_ua_device/") { error 702 "OK"; }
if (req.url ~ "^/devicetest") { set req.backend = devicetest; }
# 701/702 are arbitrary chosen return codes that is only used internally in varnish.
if (req.url ~ "^/set_ua_device/.+") {
error 701 regsub(req.url, "^/set_ua_device/", "");
}
# set expired cookie if nothing is specified
if (req.url ~ "^/set_ua_device/") {
error 702 "OK";
}
if (req.url ~ "^/devicetest") {
set req.backend = devicetest;
}
}
sub vcl_error {
if (obj.status == 701 || obj.status == 702) {
if (obj.status == 702) {
set obj.status = 200;
set obj.http.Set-Cookie = "X-UA-Device-force=expiring; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;";
} else {
set obj.status = 200;
set obj.http.Set-Cookie = "X-UA-Device-force=" + obj.response + "; Path=/;";
if (obj.status == 701 || obj.status == 702) {
if (obj.status == 702) {
set obj.status = 200;
set obj.http.Set-Cookie = "X-UA-Device-force=expiring; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;";
} else {
set obj.status = 200;
set obj.http.Set-Cookie = "X-UA-Device-force=" + obj.response + "; Path=/;";
}
set obj.http.Content-Type = "text/html; charset=utf-8";
synthetic {"
<html><body><h1>
OK, Cookie updated
</h1><a
href=
'/devicetest/'
>
/devicetest/
</a></body></html>
"};
set obj.response = "OK";
return(deliver);
}
set obj.http.Content-Type = "text/html; charset=utf-8";
synthetic {"
<html><body><h1>
OK, Cookie updated
</h1><a
href=
'/devicetest/'
>
/devicetest/
</a></body></html>
"};
set obj.response = "OK";
return(deliver);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment