Page MenuHomePhabricator

When an install is instanced, include the instance identifier in the URI for file data
ClosedPublic

Authored by epriestley on Feb 3 2015, 10:46 PM.
Tags
None
Referenced Files
F14020799: D11668.diff
Wed, Nov 6, 2:41 AM
F13996213: D11668.diff
Wed, Oct 23, 7:02 PM
F13994931: D11668.diff
Wed, Oct 23, 9:31 AM
F13984074: D11668.id.diff
Sun, Oct 20, 10:49 AM
F13976382: D11668.id28080.diff
Fri, Oct 18, 2:00 PM
Unknown Object (File)
Sat, Oct 12, 1:59 AM
Unknown Object (File)
Oct 7 2024, 1:14 AM
Unknown Object (File)
Oct 6 2024, 4:37 PM
Subscribers

Details

Summary

This allows us to CDN the cluster.

General problem is that we can't easily give each instance its own CDN URI (giraffe.phcdn.net) in Cloudfront, because it requires that you enumerate all aliases (and there's a limit of 100) and depends on SNI (a newish feature of SSL which allows one server to serve multiple certificates, but which doesn't have full support everywhere yet).

It's possible that we could eventually work around this, or use Cloudflare instead (which has a different model that seems like a slightly easier fit for CDN-domain-per-instance), but I don't want to sink a ton of work into this and want to keep things on AWS insofar as we reasonably can.

The easiest way to fix this is just to put the instance identity into URIs, then read it out when handling CDN requests. This has no effect on installs without cluster instance configuration, which is all of them except ours.

It's also slightly desirable to share this stuff, since we get to share the cache for static resources, which are always identical across instances.

So requests go from the Cloudfront gateway ("xyz.cloudfront.com") to the LB with a hard-coded instance name ("cdn.phacility.com"), which gets them routed to a balanced web machine. The web machine picks the correct instance name out of the URI, acts as that instance, and does the correct thing.

The messiest part of this is that we need "cdn.phacility.com" to be a real instance so it can serve static resources, but that's not a big deal. We have a few other hard-codes which have to be real resources for now, like we must have a merchant named "Phacility".

Test Plan
  • Viewed files with security.alternate-file-domain off (i.e., no file tokens).
  • Viewed pages and files with security.alternate-file-domain on. Saw correct resource behavior, @isntance generation of URIs, and correct token redirect behavior for files.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

epriestley retitled this revision from to When an install is instanced, include the instance identifier in the URI.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: btrahan.
btrahan edited edge metadata.
This revision is now accepted and ready to land.Feb 3 2015, 10:52 PM
epriestley retitled this revision from When an install is instanced, include the instance identifier in the URI to When an install is instanced, include the instance identifier in the URI for file data.Feb 3 2015, 10:53 PM
epriestley edited edge metadata.
epriestley updated this object.
This revision was automatically updated to reflect the committed changes.