From 6ff2c8acae606ab6839a3a0eda77d9e016f5472a Mon Sep 17 00:00:00 2001 From: Colin Date: Fri, 12 May 2023 03:05:26 +0000 Subject: [PATCH] lemmy: restrict the http_accept types i forward to the backend it seems that forwarding `POST`s is the important part i was missing earlier --- hosts/by-name/servo/services/lemmy.nix | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/hosts/by-name/servo/services/lemmy.nix b/hosts/by-name/servo/services/lemmy.nix index 22ef4d5a..1c4b2358 100644 --- a/hosts/by-name/servo/services/lemmy.nix +++ b/hosts/by-name/servo/services/lemmy.nix @@ -69,17 +69,17 @@ in { proxyPass = "$proxpass"; extraConfig = '' set $proxpass "${ui}"; - # if ($http_accept = "application/activity+json") { - # set $proxpass "${backend}"; - # } - # if ($http_accept = "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"") { - # set $proxpass "${backend}"; - # } - - # XXX: lemmy-ansible nginx uses this maximally broad redirection - if ($http_accept ~ "^application/.*$") { + if ($http_accept = "application/activity+json") { set $proxpass "${backend}"; } + if ($http_accept = "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"") { + set $proxpass "${backend}"; + } + + # XXX: lemmy-ansible nginx uses this maximally broad redirection + # if ($http_accept ~ "^application/.*$") { + # set $proxpass "${backend}"; + # } # XXX: POST redirection occurs in lemmy-ansible and docker/nginx.conf but not docker/federation/nginx.conf if ($request_method = POST) { set $proxpass "${backend}";