alphagov/pp-puppet — pull request #146 by alexmuller (2013-11-22 22:32:59+00:00)
Title: Add assets vhost to the frontend machines

Like most things Puppet, I'm not sure if this is the cleanest way to achieve the desired result.

Assets will be served from `assets.env.pp-domain`.

This commit adds a vhost listening on 80 and 443 on that subdomain to the frontend machines, with a root inside `/var/www/{subdomain}` (by default).

It then adds some extra nginx config to the end of that server block so that all requests under `/spotlight` are served from the public directory of the current Spotlight deployment.

assets.perfplat.dev/spotlight/index.css -> /opt/spotlight/current/public/index.css

We set 2 hour cache times and send an etag. Once we've verified that we're doing proper cachebusting in the app, we can increase that `Expires` header to months or years.

I hope our admin interface will follow the same pattern.