diff --git a/hosts/by-name/servo/services/lemmy.nix b/hosts/by-name/servo/services/lemmy.nix index adfdb582..1766ded7 100644 --- a/hosts/by-name/servo/services/lemmy.nix +++ b/hosts/by-name/servo/services/lemmy.nix @@ -9,8 +9,10 @@ in { services.lemmy = { enable = true; settings.hostname = "lemmy.uninsane.org"; - settings.options.federation.enabled = true; - settings.options.port = backendPort; + settings.federation.enabled = true; + # federation.debug forces outbound federation queries to be run synchronously + settings.federation.debug = true; + settings.port = backendPort; # settings.database.host = "localhost"; # defaults # settings.database = { @@ -34,6 +36,7 @@ in { }; systemd.services.lemmy.environment = { RUST_BACKTRACE = "full"; + RUST_LOG = "debug"; # upstream defaults LEMMY_DATABASE_URL = "postgres:///lemmy?host=/run/postgresql"; # - Postgres complains that we didn't specify a user # lemmy formats the url as: @@ -60,24 +63,36 @@ in { in { # see # see + # see "/" = { # "frontend general requests" - proxyPass = "$proxpass"; + # 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}; + 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/.*$") { + set $proxpass "${backend}"; } # XXX: POST redirection occurs in docker/nginx.conf but not docker/federation/nginx.conf - # if ($request_method = POST) { - # set $proxpass ${backend}; - # } + if ($request_method = POST) { + set $proxpass "${backend}"; + } + + proxy_pass $proxpass; # Cuts off the trailing slash on URLs to make them valid rewrite ^(.+)/+$ $1 permanent; + + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; ''; }; "~ ^/(api|pictrs|feeds|nodeinfo|.well-known)" = {