Fastly configure x-ua-device Mobile detection

Type: Delivery

Code: set resp.http.x-ua-device = req.http.x-ua-device;

priority:100


Type: Fetch 

Code:

# Add Device type to Vary header

if (req.http.x-ua-device) {

  if (!beresp.http.Vary) {

    set beresp.http.Vary = "x-ua-device";

  } else if (beresp.http.Vary !~ "x-ua-device")  {

    set beresp.http.Vary = beresp.http.Vary ", x-ua-device";

  }

}

priority: 100


Type: recv

code:

set req.http.x-ua-device = "pc";

if (client.platform.mobile) {

        set req.http.x-ua-device = "mobile";

}

priority: 100

Comments