guardian/frontend — pull request #3150 by commuterjoy (2014-02-17 14:24:48+00:00)
Title: R1 redirects

A first stab at using the AWS DynamoDB for managing our fine heritage of excessive HTTP redirection.

- Queries DynamoDB to look for redirect matches (and sends a http 301 if found).
- Queries S3 to look for archive pages (and sends the archived file contents along with an http 200)
- If it doesn't find anything then it serves a 404.

The former currently houses 1.5m R1 redirects, and the S3 bucket houses a few hundred thousand R1 files taken off the docroot.

Either, we can proxy to this end point for known URLs _or_ catch responses from the application servers with `X-Accel-Redirect` headers.

Eg,

- http://localhost:9000/404/www.theguardian.com/media/emailservices/article/0,,1694396,.html - found in dynamo (http 301)
- http://localhost:9000/404/travel.theguardian.com/askatraveller/0,,345059,00.html - archived in s3 (http 200)
- http://localhost:9000/404/www.theguardian.com/i/am/not/here.html - not found (http 404)

Misc.

- @gklopper I'm introducing this in to Applications while I test this whole idea, but we split it off to a dedicated stack (later please?).
- Lacks tests.

Scala folk - be kind.

/cc @gklopper