Closed
Bug 887940
Opened 12 years ago
Closed 12 years ago
Redirect non-latest, non-ESR versions of Firefox Desktop download requests to /firefox/new/
Categories
(www.mozilla.org :: Legacy PHP system, defect)
www.mozilla.org
Legacy PHP system
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: cmore, Assigned: kohei)
References
(Blocks 1 open bug)
Details
(Whiteboard: [kb=1038602] r=117883,118477,118478 b=trunk)
Attachments
(1 file, 3 obsolete files)
|
917 bytes,
patch
|
osmose
:
review+
|
Details | Diff | Splinter Review |
Related to bug 886316, we have a lot of traffic to this URL from recent versions of Firefox:
/en-US/products/download.html
The top 5 requested versions are:
/en-US/products/download.html?product=firefox-17.0.1&os=win&lang=en-US
/en-US/products/download.html?product=firefox-15.0.1&os=win&lang=en-US
/en-US/products/download.html?product=firefox-20.0&os=win&lang=en-US
/en-US/products/download.html?product=firefox-16.0.2&os=win&lang=en-US
/en-US/products/download.html?product=firefox-19.0.2&os=win&lang=en-US
The majority of the downloads are to the first two links and most of them are coming from bing.com searches.
I propose an intelligent redirect in the php that will use the product details meta data.
Here's the logic that I am thinking:
If ( product version >= 4.0 and product version <= latest-version-1) && (cgi. referrer does not contain "mozilla.org") && (product does not contain "esr") Then
redirect: /firefox/new/ (no locale)
This logic will redirect anyone trying to download non-ESR versions newer than version 4 up to the previous version but not any links from mozilla.org. This will have to be in the php logic here:
http://viewvc.svn.mozilla.org/vc/projects/mozilla.com/trunk/en-US/products/download.html?view=markup
Why is this urgent to do this now? Over the past 30 days 128k downloads that matches the logic above. This php page will be going away eventually, but for now, we are really damaging the onboarding experience by giving people a download an old version of Firefox.
| Assignee | ||
Comment 1•12 years ago
|
||
Taking. I'd like to resolve Bug 710824 as well.
Assignee: nobody → kohei.yoshino.bugs
Status: NEW → ASSIGNED
OS: Mac OS X → All
Hardware: x86 → All
| Assignee | ||
Updated•12 years ago
|
Component: General → Legacy PHP system
| Assignee | ||
Comment 2•12 years ago
|
||
BTW, I'd like to avoid referrer check; it's just annoying. Many people, including me, have disabled referrer on their browser or by a security software.
| Reporter | ||
Comment 3•12 years ago
|
||
(In reply to Kohei Yoshino [:kohei] from comment #2)
> BTW, I'd like to avoid referrer check; it's just annoying. Many people,
> including me, have disabled referrer on their browser or by a security
> software.
Yeah, but you're probably a minority and power users probably won't fall into this SEO trap. I wanted to avoid messing up any links on mozilla.org that are purposely to those older version.
| Reporter | ||
Comment 4•12 years ago
|
||
(In reply to Kohei Yoshino [:kohei] from comment #1)
> Taking. I'd like to resolve Bug 710824 as well.
I'd rather focus on getting this non-latest bug fixed first. As for bug 710814, I don't know if it is worth it since this php page will be going away all together later this year when download buttons are pointed to the second scene of the unified product download page. Let's focus on this redirect first.
Comment 5•12 years ago
|
||
I think the referrer check is fine. I have referrer turned off for different domains, but on for interdomain links so that things like Django's CSRF stuff doesn't fail for some logins. In cmore's logic I think it'll be fine, even in the case with referrers turned off completely, they'll just get the new version, which is what they probably meant.
Are you sure that "esr" is in the product string for those builds? I know for the "do you need an update" logic on the site we just have to go by the version number (10 or 17), but I've never looked into the download flow for ESR builds. I'm not aware of any links to ESR builds on the site actually.
The only other thing I can think of is that if this isn't what the people meant, and they really did want an old version, we could potentially add some messaging to the download page saying something like (you're downloading the latest version of Firefox. To download the older version from the link you followed, click here). That might be overly confusing. Also, my guess is that any page pointing to older builds deliberately will point directly at bouncer. So this is probably fine as stated by cmore.
Comment 6•12 years ago
|
||
The esr releases can be found here http://www.mozilla.org/en-US/firefox/organizations/all.html
The download links have esr in them example
https://download.mozilla.org/?product=firefox-17.0.7esr&os=osx&lang=en-US
| Reporter | ||
Comment 7•12 years ago
|
||
ESR links are download from here:
http://www.mozilla.org/en-US/firefox/organizations/all.html
The links go directly to download.mozilla.org and not /en-US/products/download.html.
Notice the "esr" at the end of the product query parameter. I have seen some requests to the /products/download.html with "esr" as a substring in the product parameter.
| Reporter | ||
Comment 8•12 years ago
|
||
Yes, what Raymond said. :)
| Assignee | ||
Comment 9•12 years ago
|
||
Okay, I'll add a referrer check.
Bug 710824 will be resolved at the same time, as we anyway check
> isset($_GET['product'])
We can ignore ESR because all those links directly point to the bouncer.
How about 3.6.x or older versions?
| Assignee | ||
Comment 10•12 years ago
|
||
This allows users to download only the latest beta and release versions.
| Assignee | ||
Comment 11•12 years ago
|
||
Oops, the redirect should be permanent like this
> header('Location: /firefox/new/', true, 302);
| Assignee | ||
Comment 12•12 years ago
|
||
Attachment #768574 -
Attachment is obsolete: true
| Reporter | ||
Comment 13•12 years ago
|
||
(In reply to Kohei Yoshino [:kohei] from comment #12)
> Created attachment 768617 [details] [diff] [review]
> proposed patch 1.1
Nice work! If we can get pmac to review, I would like to test this on -dev. We will have to manually update the product details on dev since it hasn't been updated from prod in quite a while.
Comment 14•12 years ago
|
||
Comment on attachment 768617 [details] [diff] [review]
proposed patch 1.1
Review of attachment 768617 [details] [diff] [review]:
-----------------------------------------------------------------
r+ besides my one comment, do you need me to merge or anything?
::: en-US/products/download.html
@@ +5,5 @@
> + strpos($_SERVER['HTTP_REFERER'],
> + $config['url_scheme'] . '://' . $config['server_name']) !== 0) {
> + return false;
> + }
> + list($product, $version) = explode('-', $_GET['product'], 2);
I'm rusty on my PHP, but I believe this will vomit if product doesn't have a - in it. Can you catch this error (or do a check beforehand) and return false if it fails?
Attachment #768617 -
Flags: review+
Comment 15•12 years ago
|
||
I glanced at the patch and it uses short array syntax which requires an up to date version of PHP (>5.4). I don't know which version we have as it is not documented, but historically we have always had old versions of PHP on mozilla.org, we are probably running on some 5.2 or 5.3 version that will have problems with recent PHP syntax. Also, it's a good practice to add an exit; command after redirecting via header() because the redirection does not mean that the rest of the script is not executed.
| Reporter | ||
Comment 16•12 years ago
|
||
I am asking jakem if he can find out what version of php we are running on the legacy cluster.
| Reporter | ||
Comment 17•12 years ago
|
||
We are running php 5.3.3. Kohei, can you get the code working with something compatible with 5.3.3?
| Assignee | ||
Comment 18•12 years ago
|
||
(In reply to Pascal Chevrel:pascalc from comment #15)
> it uses short array syntax which requires an up to date version of PHP (>5.4).
I have totally forgot about that ;-) This code is not JavaScript nor Python... Will fix my patch along with other issues.
| Assignee | ||
Comment 19•12 years ago
|
||
Thank you for your feedback! Hope it works out.
Attachment #768617 -
Attachment is obsolete: true
Comment 20•12 years ago
|
||
I think there are several potential problems:
- This download page can trigger downloads for all of our products, that's why it is under products/ and not under firefox/, in the past it was also used by thunderbird pages and if you change firefox by thunderbird in the url it still works. Potentially we could redirect requests to thunderbird downloads to the Firefox download page.
- For the same reasons I think we should discard requests to ESR, they do work.
- We (I, at least :) ) don't know which list of keywords exist for the download urls (latest, stub, beta...). I don't think we should redirect based on a short list of keywords, usually those keywords were created to avoid version problems and serve the latest build for a channel, we shouldn't try to replicate that logic.
- generally speaking, I think we should also fix the cases of links to download.html outside of mozilla.org, not just fix the schemes that correspond to internal links. I wouldn't be surprised to know that there are links on the web pointing to download.html and using variables (download sites like softonic, clubix, download.com... that propose a 'free' download from the editor's website, links in support forums...)
I patched your patch :) to fix those cases if you are interested (yay for insomnia...)
| Assignee | ||
Comment 21•12 years ago
|
||
So the code should be simpler as cmore said in his comment 0. This won't affect Thunderbird nor ESR versions.
Attachment #769898 -
Attachment is obsolete: true
Comment 22•12 years ago
|
||
Here is what I had come up with in case you want to look :)
https://gist.github.com/pascalchevrel/5906395#file-gistfile1-php
| Reporter | ||
Comment 23•12 years ago
|
||
Thanks, Kohei and Pascal.
So, are we going forward with Kohei or Pascal's patch? I want mkelly to do a code review and I don't want to have him review two patches.
| Reporter | ||
Comment 24•12 years ago
|
||
We need to get this resolved ASAP. We are possibly losing ton of users a day to old downloads and that's bad for ADIs and UX. Let's get this wrapped up this week, reviewed and QA'd.
Who's patch should mkelly or sancus review?
| Reporter | ||
Comment 25•12 years ago
|
||
Mkelly: can you help out with a review of patch in comment 21?
Flags: needinfo?(mkelly)
| Reporter | ||
Updated•12 years ago
|
Whiteboard: [kb=1038602]
Comment 26•12 years ago
|
||
Comment on attachment 770100 [details] [diff] [review]
proposed patch 2.0
Review of attachment 770100 [details] [diff] [review]:
-----------------------------------------------------------------
Looks fine to me (taken with a grain of salt considering my PHP rustiness :P)
Attachment #770100 -
Flags: review+
Updated•12 years ago
|
Flags: needinfo?(mkelly)
| Reporter | ||
Comment 27•12 years ago
|
||
Ok, thanks, mkelly! Let's get this merged and on -dev so that Raymond can test this. It should be pretty easy to test since we can define all of the different use-cases that should triger the redirect and the ones that should not. I can put together an etherpad of test cases with Raymond.
| Assignee | ||
Comment 28•12 years ago
|
||
Committed to trunk at r117883. It will be testable on -dev soon.
| Reporter | ||
Comment 29•12 years ago
|
||
This does not appear working on www-dev.allizom.org as the following URLs don't redirect:
https://www-dev.allizom.org/en-US/products/download.html?product=firefox-17.0.1&os=win&lang=en-US
https://www-dev.allizom.org/en-US/products/download.html?product=firefox-17.0.1&os=win&lang=en-US
https://www-dev.allizom.org/en-US/products/download.html?product=firefox-15.0.1&os=win&lang=en-US
https://www-dev.allizom.org/en-US/products/download.html?product=firefox-20.0&os=win&lang=en-US
https://www-dev.allizom.org/en-US/products/download.html?product=firefox-16.0.2&os=win&lang=en-US
https://www-dev.allizom.org/en-US/products/download.html?product=firefox-19.0.2&os=win&lang=en-US
| Reporter | ||
Comment 30•12 years ago
|
||
Hmmm, nevermind. All the URLs in comment 29 are now magically working.
| Reporter | ||
Comment 31•12 years ago
|
||
These URLs should *not* redirect:
https://www-dev.allizom.org/en-US/products/download.html?product=firefox-22.0&os=win&lang=en-US
https://www-dev.allizom.org/en-US/products/download.html?product=firefox-23.0&os=win&lang=en-US
https://www-dev.allizom.org/en-US/products/download.html?product=firefox-24.0&os=win&lang=en-US
https://www-dev.allizom.org/en-US/products/download.html?product=firefox-25.0&os=win&lang=en-US
https://www-dev.allizom.org/en-US/products/download.html?product=firefox-17.0.7esr&os=osx&lang=en-US
| Reporter | ||
Comment 32•12 years ago
|
||
Also, I tested this URL and it doesn't redirect as expected:
https://www-dev.allizom.org/en-US/products/download.html?product=firefox-stub&os=win&lang=en-US
| Reporter | ||
Comment 33•12 years ago
|
||
This URL also checked out fine:
https://www-dev.allizom.org/en-US/products/download.html?product=firefox-beta-stub&os=win&lang=en-US
This URL below did not redirect and it should have:
https://www-dev.allizom.org/en-US/products/download.html?product=firefox-18.0&os=win&lang=en-US
https://www-dev.allizom.org/en-US/products/download.html?product=firefox-21.0&os=win&lang=en-US
https://www-dev.allizom.org/en-US/products/download.html?product=firefox-16.0.2&os=win&lang=en-US
| Reporter | ||
Comment 34•12 years ago
|
||
Koehi: Can you check out the 3 URLs in comment 33 to see why they are not redirecting?
Comment 35•12 years ago
|
||
https://www-dev.allizom.org/en-US/products/download.html?product=firefox-18.0&os=win&lang=en-US
https://www-dev.allizom.org/en-US/products/download.html?product=firefox-21.0&os=win&lang=en-US
https://www-dev.allizom.org/en-US/products/download.html?product=firefox-16.0.2&os=win&lang=en-US
worked for me they all redirected to
https://www-dev.allizom.org/en-US/firefox/new/
| Reporter | ||
Comment 36•12 years ago
|
||
Hmmm, I opened chrome, cleared cached, pasted in the URL https://www-dev.allizom.org/en-US/products/download.html?product=firefox-18.0&os=win&lang=en-US hit enter, and it went to the download page and not to /firefox/new/.
| Reporter | ||
Comment 37•12 years ago
|
||
Also, there is a link to Firefox 3 on this page: http://www.sharephim.net/xem/Phim-5778-425230.html (at the very bottom) to: http://www.mozilla.com/en-US/products/download.html?product=firefox-3.0.6&os=win&lang=en-US
The original bug said any Firefox versions greater than version 4. Should we worry about pre-4? My main concern was post Firefox 4.
| Reporter | ||
Comment 38•12 years ago
|
||
Ok, now all the URLs in comment 33 are redirecting fine. Still an open question about comment 37.
| Assignee | ||
Comment 39•12 years ago
|
||
(In reply to Chris More [:cmore] from comment #36)
> Hmmm, I opened chrome, cleared cached, pasted in the URL
> https://www-dev.allizom.org/en-US/products/download.html?product=firefox-18.
> 0&os=win&lang=en-US hit enter, and it went to the download page and not to
> /firefox/new/.
If the referer header is not set, you won't be redirected to /firefox/
(In reply to Chris More [:cmore] from comment #37)
> The original bug said any Firefox versions greater than version 4. Should we
> worry about pre-4? My main concern was post Firefox 4.
My patch is a simple comparison like this, so it covers pre-4 versions.
> intval($matches[1]) < intval(LATEST_FIREFOX_VERSION)
| Reporter | ||
Comment 40•12 years ago
|
||
(In reply to Kohei Yoshino [:kohei] from comment #39)
> (In reply to Chris More [:cmore] from comment #36)
> > Hmmm, I opened chrome, cleared cached, pasted in the URL
> > https://www-dev.allizom.org/en-US/products/download.html?product=firefox-18.
> > 0&os=win&lang=en-US hit enter, and it went to the download page and not to
> > /firefox/new/.
>
> If the referer header is not set, you won't be redirected to /firefox/
Ok, this explains why when I try to go to direct traffic via the address bar that it won't redirect until I click the link in bugzilla. thanks.
> (In reply to Chris More [:cmore] from comment #37)
> > The original bug said any Firefox versions greater than version 4. Should we
> > worry about pre-4? My main concern was post Firefox 4.
>
> My patch is a simple comparison like this, so it covers pre-4 versions.
>
> > intval($matches[1]) < intval(LATEST_FIREFOX_VERSION)
Then why doesn't this redirect?
http://www.mozilla.com/en-US/products/download.html?product=firefox-3.0.6&os=win&lang=en-US
| Assignee | ||
Comment 41•12 years ago
|
||
(In reply to Chris More [:cmore] from comment #40)
> Then why doesn't this redirect?
>
> http://www.mozilla.com/en-US/products/download.html?product=firefox-3.0.
> 6&os=win&lang=en-US
I just tested it locally and was redirected as expected.
1. On the local environment, change the link of the download button to
https://www-dev.allizom.org/en-US/products/download.html?product=firefox-3.0.6&os=win&lang=en-US using Firebug
2. Click the button
Here, intval($matches[1]) is 3, $_SERVER['HTTP_REFERER'] is http://local.mozilla.org/en-US/firefox/new/ in my case (it doesn't contain https://www-dev.allizom.org/), so it should work.
| Reporter | ||
Comment 42•12 years ago
|
||
It works now. The 301 redirect was cached in Firefox when I sent it direct traffic. :) That has got me all day. ha
| Assignee | ||
Updated•12 years ago
|
Blocks: mozorg-redirects
| Assignee | ||
Comment 44•12 years ago
|
||
So is it ready to merge?
| Reporter | ||
Comment 45•12 years ago
|
||
(In reply to Kohei Yoshino [:kohei] from comment #44)
> So is it ready to merge?
If the code is good to go, reviewed, let's merge and get this out there.
| Assignee | ||
Comment 46•12 years ago
|
||
mkelly: could you merge r117883 to stage/prod? Thanks!
Flags: needinfo?(mkelly)
Comment 47•12 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Flags: needinfo?(mkelly)
Resolution: --- → FIXED
Whiteboard: [kb=1038602] r=117883 b=trunk → [kb=1038602] r=117883,118477,118478 b=trunk
You need to log in
before you can comment on or make changes to this bug.
Description
•