Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sub vcl_recv {
- if (req.url ~ "\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf)$") {
- set req.http.X-Device = "NA";
- } else {
- call identify_device;
- }
- }
- sub identify_device {
- if (req.http.User-Agent ~ "mobileapp" ) {
- set req.http.X-Device = "mobileapp";
- } else {
- set req.http.X-Device = "PC";
- }
- }
- sub vcl_deliver {
- if (req.http.X-Device != "NA") {
- if (resp.http.Vary) {
- set resp.http.Vary = resp.http.Vary + "," + "User-Agent";
- } else {
- set resp.http.Vary = "User-Agent";
- }
- }
- }
- sub vcl_hash {
- hash_data(req.http.X-Device);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement