Mastodon nginx: simplify static files

merge-requests/1355/head
Alex Gleason 2022-05-11 17:55:12 -05:00
rodzic 20c5519e04
commit 2a389ab225
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
1 zmienionych plików z 8 dodań i 11 usunięć

Wyświetl plik

@ -73,7 +73,7 @@ server {
# Fallback route.
# Everything not routed should fall back to the SPA.
location / {
try_files /index.html /dev/null;
try_files /dev/null @static-files;
}
# Mastodon backend routes.
@ -88,21 +88,12 @@ server {
try_files $activitypub_location $activitypub_location;
}
# Mastodon public files.
# https://github.com/mastodon/mastodon/tree/main/public
# Take only what we need for Soapbox.
location ~ ^/(assets|favicon.(ico|png)|browserconfig.xml|embed.js|android-chrome-192x192.png|apple-touch-icon.png|(avatars|headers)/original/missing.png) {
root /home/mastodon/live/public;
add_header Cache-Control "public, max-age=31536000, immutable";
add_header Strict-Transport-Security "max-age=31536000" always;
}
# Soapbox & Mastodon (frontend) build files.
# New builds produce hashed filenames, so these should be cached heavily.
location /packs {
add_header Cache-Control "public, max-age=31536000, immutable";
add_header Strict-Transport-Security "max-age=31536000" always;
try_files $uri @mastodon-public;
try_files /dev/null @static-files;
}
# Soapbox configuration files.
@ -124,6 +115,12 @@ server {
try_files $uri /index.html;
}
# Soapbox & Mastodon static files.
# Try Soapbox first, Mastodon, then fall back to the SPA.
location @static-files {
try_files $uri @mastodon-public;
}
# Proxy to Mastodon's Ruby on Rails backend.
location @proxy {
proxy_set_header Host $host;