diff --git a/deploy/files/sites-available/impress.conf b/deploy/files/sites-available/impress.conf index df3d1ff7..cbb3ae4f 100644 --- a/deploy/files/sites-available/impress.conf +++ b/deploy/files/sites-available/impress.conf @@ -17,6 +17,18 @@ server { root /srv/impress/current/public; + # Serve assets using their precompressed *.gz versions. + # The filenames contain content hashes, so they should be safe to + # cache forever. + # https://stackoverflow.com/a/6952804/107415 + location ~ ^/assets/ { + gzip_static on; + expires max; + add_header Cache-Control public; + add_header Last-Modified ""; + add_header ETag ""; + } + # Try serving static files first. If not found, fall back to the app. try_files $uri/index.html $uri @app;