varnishcache / varnish-devicedetect Goto Github PK
View Code? Open in Web Editor NEWVCL based device detection for Varnish Cache.
License: Other
VCL based device detection for Varnish Cache.
License: Other
Well, it's obviously not an issue but I'm curious about this choice. Any particular reason?
Hi,
Could you please add FirefoxOS to list of mobile devices.
According to Mozilla, User-Agent is:
Mozilla/5.0 (Mobile; rv:15.0) Gecko/15.0 Firefox/15.0
Please, avoid confusion with Firefox for Android:
Mozilla/5.0 (Android; Mobile; rv:15.0) Gecko/15.0 Firefox/15.0
Thank you very much.
I compared varnish-device detect method with UA Parser and I noticed that varnish method not detected Tablet PC devices as a mobile (where regexp_like(useragent, '(Tablet._PC|PC._Tablet)', 'i')).
I uploaded sample of user agents on the gist:
https://gist.github.com/pongacm/b7775bebf2b26c09e1f8
Wikipedia says that tablet PC is a tablet:
http://en.wikipedia.org/wiki/Microsoft_Tablet_PC
I'm analyst so I can't prepare pull request. Is any chance to improve varnish-device detect by somone with you?
I wrote this on a comment on the commit 17c109a but it might be better to do it here:
This pattern is not correct. The second [] should be ().
The architecture is only valid on IE 10 under Windows 8 or later.
This needs to be studied a bit further but I don't think this change is correct.
For more user-agents you can use following device-detect.vcl from repo:
https://github.com/miniyarov/varnish-mobiletranslate
Hi,
I'm about to use this code at my company. Could you specify a licence under which we can use it?
Thanks.
I just stumbled upon a piece of weird behaviour in the latest iOS release.
We are using varnish to redirect specific urls when accessing them with a smartphone. This works perfectly except when using the iOS “Add to Home Screen” option for bookmarking pages as icons on the app home screen. The bookmark works as expected, but the icon for the app (a link to which is defined in the source of the bookmarked html page) does not.
Safari “correctly” identifies itself using this User-Agent header:
Mozilla/5.0 (iPhone; CPU iPhone OS 7_1 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D167 Safari/9537.53
Which is caught by the Varnish devicedetect rule just fine, but when inspecting the requests coming out of the iPhone upon using “Add to Home Screen” the User-Agent header for the requests for the icons was:
MobileSafari/9537.53 CFNetwork/672.1.13 Darwin/13.1.0
Probably because the requests for the icons are handled by the OS rather than Safari (my guess), but the effect is that this evades the devicedetect rule altogether and causes the requests for the icons to 404.
Greetings,
I really want to try this out. I have a Symfony app running behind Varnish and the performance is really good, but as always, it can be be better.
All requests must reach the app then, depending on certain parameters, a specific response is generated. I cache db heavy fragments of the page using ESI. One of those parameters is Device detection. I currently use https://github.com/serbanghita/Mobile-Detect.
I have been profiling my app and the response times for the home page is 179ms, a whooping 125ms of which is for device detection.
I am curious to the performance of mobile detection using Varnish, has anyone ever benchmarked it out? Of course, written in C should make it really fast but how much? I know the best way is to profile myself but you see, it will mean changing my app code entirely which will take days, I was wondering if anyone had rough estimates/ideas.
Regards.
Hi,
according to this page:
https://support.google.com/webmasters/answer/1061943
google has a new mobile bot, maybe (as per our analysis) since April 19th
In order to catch it, I've made a little change in the vcl, this one:
43c43
(req.http.User-Agent ~ "(iPhone|Android)" && req.http.User-Agent ~ "\(compatible; Googlebot/2.1; \+http://www.google.com/bot.html")) {
let me know if you need a pull request
thanks,
corrado
I am using Varnish 6.2.1 + Ubuntu 20.04.
Hi,
I'd suggest improving the detection getting the detection logic from https://github.com/serbanghita/Mobile-Detect/blob/master/Mobile_Detect.json
It's just an idea, we made that .json
to allow people to better port the script. We update it also on every release.
Right now all bots are grouped together into a single X-UA-Device of 'bot'. But Google, for example, has bots that are specifically used for crawling mobile sites. See:
https://developers.google.com/webmasters/smartphone-sites/googlebot-mobile
http://googlewebmastercentral.blogspot.com/2014/01/a-new-googlebot-user-agent-for-crawling.html
I'm not sure of whether there are other "mobile bot" user agents, but it might make sense to have a 'mobile-bot' X-UA-Device.
Google has 'mobile' crawlers that identify as smartphone and feature phone. These rules are not classifying it as mobile.
Reference: https://developers.google.com/webmasters/mobile-sites/references/googlebot
It looks like there isn't a definition for a mobile-bot.
Hi,
I'm looking for sharing an existing VCL which parses User-Agent
to detect if the browser supports the SameSite=None
i.e. Set-Cookie: x=y; SameSite=None
.
That's required to be set to allow 3rd party Cookies for the next Chrome version 80; see https://www.chromium.org/updates/same-site/incompatible-clients going mainstream in a couple of days.
I don't know if this repository is the right one, or if you have other suggestions ?
Hi
You may want to add a reference to WURFL and ScientiaMobile as one of the possibilities to enrich Varnish-Cache with Device Detection abilities:
http://www.scientiamobile.com/blog/post/view/id/25/title/HTTP-and-Mobile%3A-The-Missing-Header-
Luca Passani
Despite Facebook using 'iPad' in their user agent, the Facebook browser is detected as being a mobile device instead of a tablet in the vcl.
Hi, we're using this VCL and we get wrong detections in several computers.
Sometimes it detects chrome on windows as smartphone and sometimes it detects android chrome as a desktop.
Is this a known issue or something went wrong with the implementation?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.