Platform detection in Zeus

RESOLVED FIXED

Status

--
minor
RESOLVED FIXED
8 years ago
4 years ago

People

(Reporter: abuchanan, Assigned: oremj)

Tracking

Details

(Reporter)

Description

8 years ago
Implementing simple platform detection in Zeus and setting a custom header with the result, e.g. Moz-Platform: MacOSX, would allow us to Vary: Moz-Platform, which would simplify our download button code on mozilla.com (and make our pages faster too).

The TrafficScript would look something like,

$ua = http.getHeader("User-Agent");

$os_windows = 'windows';
$os_mac = 'mac';
$os_mac_osx = 'macosx';
$os_linus = 'linux';
$os_solaris = 'solaris';
$os_other = 'other';
$os = $os_other;

if (string.find("Win32", $ua) != -1 || string.find("Win64", $ua) != -1)
  $os = $os_windows;
else if (string.find("Linux", $ua) != -1)
  $os = $os_linux;
else if (string.find("Mac OS X", $ua) != -1)
  $os = $os_macosx;
else if (string.find("MSIE 5.2"", $ua) != -1)
  $os = $os_macosx;
else if (string.find("Mac"", $ua) != -1) {
  $os = $os_mac;

  # Special case for Opera on OS X emulating IE (bug 402113)
  if ((string.find("Opera"", $ua) != -1) && (string.find("Opera 6"", $ua) == -1))
    $os = $os_macosx;

} else if (string.find("SunOS", $ua) != -1)
  $os = $os_solaris;
else
  $os = $os_other;

http.addHeader('Moz-Platform', $os);


What do you think?  Good idea?  Terrible idea?
Over to Jeremy for an eval
Assignee: server-ops → jeremy.orem+bugs
(Reporter)

Comment 2

8 years ago
Will you have a chance to look at this soon?

Comment 3

8 years ago
alex, he's out until Thursday - do you need this sooner?
(Reporter)

Comment 4

8 years ago
(In reply to comment #3)
> alex, he's out until Thursday - do you need this sooner?

ah, ok thanks.  no, it can wait.
(Assignee)

Comment 5

8 years ago
I have this traffic script in Zeus, and the header will be "X-Moz-Platform" where should I enable to test it out?
(Reporter)

Comment 6

8 years ago
How about www-trunk.stage?  Or, even mozilla.com production, since it's an extra header, it shouldn't disrupt anything.
(Assignee)

Comment 7

8 years ago
I've added this to production. www-trunk.stage is still behind the netscaler.
(Assignee)

Updated

8 years ago
Status: NEW → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED
Product: mozilla.org → mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.