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
936e93e6
Commit
936e93e6
authored
Jul 02, 2015
by
Lasse Karstensen
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #24 from fgsch/master
Minor updates
parents
42321e3c
74ad7dbb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
INSTALL.rst
INSTALL.rst
+3
-3
README.rst
README.rst
+3
-3
devicedetect.vcl
devicedetect.vcl
+1
-1
No files found.
INSTALL.rst
View file @
936e93e6
...
@@ -46,7 +46,7 @@ VCL::
...
@@ -46,7 +46,7 @@ VCL::
if (bereq.http.X-UA-Device) {
if (bereq.http.X-UA-Device) {
if (!beresp.http.Vary) { # no Vary at all
if (!beresp.http.Vary) { # no Vary at all
set beresp.http.Vary = "X-UA-Device";
set beresp.http.Vary = "X-UA-Device";
} els
e
if (beresp.http.Vary !~ "X-UA-Device") { # add to existing Vary
} elsif (beresp.http.Vary !~ "X-UA-Device") { # add to existing Vary
set beresp.http.Vary = beresp.http.Vary + ", X-UA-Device";
set beresp.http.Vary = beresp.http.Vary + ", X-UA-Device";
}
}
}
}
...
@@ -107,7 +107,7 @@ VCL::
...
@@ -107,7 +107,7 @@ VCL::
if (bereq.http.X-UA-Device) {
if (bereq.http.X-UA-Device) {
if (!beresp.http.Vary) { # no Vary at all
if (!beresp.http.Vary) { # no Vary at all
set beresp.http.Vary = "X-UA-Device";
set beresp.http.Vary = "X-UA-Device";
} els
e
if (beresp.http.Vary !~ "X-UA-Device") { # add to existing Vary
} elsif (beresp.http.Vary !~ "X-UA-Device") { # add to existing Vary
set beresp.http.Vary = beresp.http.Vary + ", X-UA-Device";
set beresp.http.Vary = beresp.http.Vary + ", X-UA-Device";
}
}
}
}
...
@@ -158,7 +158,7 @@ VCL::
...
@@ -158,7 +158,7 @@ VCL::
if (bereq.http.X-UA-Device) {
if (bereq.http.X-UA-Device) {
if (!beresp.http.Vary) { # no Vary at all
if (!beresp.http.Vary) { # no Vary at all
set beresp.http.Vary = "X-UA-Device";
set beresp.http.Vary = "X-UA-Device";
} els
e
if (beresp.http.Vary !~ "X-UA-Device") { # add to existing Vary
} elsif (beresp.http.Vary !~ "X-UA-Device") { # add to existing Vary
set beresp.http.Vary = beresp.http.Vary + ", X-UA-Device";
set beresp.http.Vary = beresp.http.Vary + ", X-UA-Device";
}
}
...
...
README.rst
View file @
936e93e6
...
@@ -2,7 +2,7 @@ Device detection in Varnish
...
@@ -2,7 +2,7 @@ Device detection in Varnish
===========================
===========================
The goal of this VCL set is to provide a simple & easy way of getting
The goal of this VCL set is to provide a simple & easy way of getting
device detection going in Varnish Cache. (http://www.varnish-cache.org)
device detection going in Varnish Cache. (http
s
://www.varnish-cache.org)
Specific problems we want to solve:
Specific problems we want to solve:
...
@@ -52,7 +52,7 @@ Similar efforts
...
@@ -52,7 +52,7 @@ Similar efforts
These similar efforts for User-Agent insights are known to us:
These similar efforts for User-Agent insights are known to us:
* http://deviceatlas.com/ (commercial)
* http
s
://deviceatlas.com/ (commercial)
* https://github.com/OpenDDRdotORG (free)
* https://github.com/OpenDDRdotORG (free)
Varnish Software has a commercial offering for DeviceAtlas lookup VMOD. Contact
Varnish Software has a commercial offering for DeviceAtlas lookup VMOD. Contact
...
@@ -78,7 +78,7 @@ Contact
...
@@ -78,7 +78,7 @@ Contact
This project lives on Github:
This project lives on Github:
http://github.com/varnish/varnish-devicedetect/
http
s
://github.com/varnish/varnish-devicedetect/
Feature requests, bug reports and such can be added to the Github issue tracker.
Feature requests, bug reports and such can be added to the Github issue tracker.
...
...
devicedetect.vcl
View file @
936e93e6
...
@@ -54,7 +54,7 @@ sub devicedetect {
...
@@ -54,7 +54,7 @@ sub devicedetect {
elsif (req.http.User-Agent ~ "(?i)android.*(mobile|mini)") { set req.http.X-UA-Device = "mobile-android"; }
elsif (req.http.User-Agent ~ "(?i)android.*(mobile|mini)") { set req.http.X-UA-Device = "mobile-android"; }
// android 3/honeycomb was just about tablet-only, and any phones will probably handle a bigger page layout.
// android 3/honeycomb was just about tablet-only, and any phones will probably handle a bigger page layout.
elsif (req.http.User-Agent ~ "(?i)android 3") { set req.http.X-UA-Device = "tablet-android"; }
elsif (req.http.User-Agent ~ "(?i)android 3") { set req.http.X-UA-Device = "tablet-android"; }
/*
see http://my.opera.com/community/openweb/idopera/
*/
/*
Opera Mobile
*/
elsif (req.http.User-Agent ~ "Opera Mobi") { set req.http.X-UA-Device = "mobile-smartphone"; }
elsif (req.http.User-Agent ~ "Opera Mobi") { set req.http.X-UA-Device = "mobile-smartphone"; }
// May very well give false positives towards android tablets. Suggestions welcome.
// May very well give false positives towards android tablets. Suggestions welcome.
elsif (req.http.User-Agent ~ "(?i)android") { set req.http.X-UA-Device = "tablet-android"; }
elsif (req.http.User-Agent ~ "(?i)android") { set req.http.X-UA-Device = "tablet-android"; }
...
...
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