Closed Bug 582042 Opened 14 years ago Closed 14 years ago

Platform detection in Zeus

Categories

(mozilla.org Graveyard :: Server Operations, task)

task
Not set
minor

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: abuchanan, Assigned: oremj)

Details

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
Will you have a chance to look at this soon?
alex, he's out until Thursday - do you need this sooner?
(In reply to comment #3)
> alex, he's out until Thursday - do you need this sooner?

ah, ok thanks.  no, it can wait.
I have this traffic script in Zeus, and the header will be "X-Moz-Platform" where should I enable to test it out?
How about www-trunk.stage?  Or, even mozilla.com production, since it's an extra header, it shouldn't disrupt anything.
I've added this to production. www-trunk.stage is still behind the netscaler.
Status: NEW → RESOLVED
Closed: 14 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.