Closed Bug 616702 Opened 14 years ago Closed 13 years ago

[tracker] Move in-product redirects into Kitsune

Categories

(support.mozilla.org :: Code Quality, task)

task
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: jsocol, Unassigned)

References

Details

In-product redirects are handled through .htaccess now, which is a pain for two reasons:

1) They required code pushes to change.
2) They require us to _have_ an .htaccess file.

As of 2.4, all pages are being served through Kitsune, so we could simplify pushes and the hosting infrastructure if we stopped using .htaccess.

I imagine something similar to django-redirect, but more specific for this purpose (actually we might need two things, one for this and one for generic things like /twitter => /army-of-awesome, but the latter is a separate bug).

We map ^1/ to an "inproduct" app with a single view that takes several arguments:

def redirect(request, product, version, platform, locale, page):

This also reduces the number of lines of regex we need from dozens to one/two.

Then we can have a redirect model that looks something like

class Redirect(Model):
    product
    version
    platform
    locale
    page

where all the fields are nullable. I'm not entirely sure how to do this yet, but I think we need to cascade down the chain, but we can do something like:

objs = Redirect.objects.all()
if objs.filter(product=product).exists():
    objs = objs.filter(product=product)
if objs.filter(version=version).exists():
    # etc...

That should cover any cases we have in the redirects right now. (Normally all of these will be NULL except page.)

We can cache these redirects for a long time so Zeus serves them, and use Hera to flush them when they change (bug 616701).
Blocks: 616703
The use case that the algorithm in comment 0 covers is basically what we have now:

/any/any/any/any/some-page is the most common, but a few take precedence:
/any/any/iPhone/any/ => article about Firefox Home.
/any/4.0b/any/any/ => article about Firefox 4.0 beta.

The queries in comment 0 should also live in memcache relatively quickly, and if we just do .exists() queries they shouldn't take up much room.
Summary: [tracer] Move in-product redirects into Kitsune → [tracker] Move in-product redirects into Kitsune
2.5 may be overly ambitious, but I wanted to get this out of "Future." Also, if we move the .htaccess file (bug 622689) then this doesn't block bug 616703.
No longer blocks: 616703
Target Milestone: Future → 2.5
Depends on: 625386
Depends on: 625387
Depends on: 629406
Depends on: 629180
Calling this done. We send cache headers for 24-hours to Zeus right now. Hera is nice to add but not crucial.
Status: NEW → RESOLVED
Closed: 13 years ago
No longer depends on: 616701
Resolution: --- → FIXED
Verified by verifying related bugs
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.