From d49e8c61a186042511a6f33cacbb377b5527bb3c Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 11 May 2022 18:22:07 -0500 Subject: [PATCH] Mastodon nginx: use `@soapbox` named location for consistency --- installation/mastodon.conf | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/installation/mastodon.conf b/installation/mastodon.conf index 7b7a01270..8c1feea65 100644 --- a/installation/mastodon.conf +++ b/installation/mastodon.conf @@ -14,7 +14,7 @@ map $http_upgrade $connection_upgrade { # ActivityPub routing. map $http_accept $activitypub_location { - default /index.html; + default @soapbox; "application/activity+json" @proxy; 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"' @proxy; } @@ -71,7 +71,7 @@ server { add_header Strict-Transport-Security "max-age=31536000" always; # Fallback route. - # Everything not routed should fall back to the SPA. + # Try static files, then fall back to the SPA. location / { try_files /dev/null @static-files; } @@ -85,7 +85,7 @@ server { # Mastodon ActivityPub routes. # Conditionally send to Mastodon by Accept header. location ~ ^/(inbox|users|@(.+)) { - try_files $activitypub_location $activitypub_location; + try_files /dev/null $activitypub_location; } # Soapbox & Mastodon (frontend) build files. @@ -108,11 +108,16 @@ server { add_header Strict-Transport-Security "max-age=31536000" always; } - # Mastodon public files. + # Soapbox SPA (Single Page App). + location @soapbox { + try_files /index.html /dev/null; + } + + # Mastodon public files (fallback to Soapbox SPA). # https://github.com/mastodon/mastodon/tree/main/public location @mastodon-public { root /home/mastodon/live/public; - try_files $uri /index.html; + try_files $uri @soapbox; } # Soapbox & Mastodon static files.