From 60a78cf8c681a674d96e8951ee0139f01df48414 Mon Sep 17 00:00:00 2001 From: Daniel Kempkens Date: Tue, 29 Nov 2022 16:51:16 +0100 Subject: [PATCH] mastodon: adjust proxy config --- system/nixos/mastodon.nix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/system/nixos/mastodon.nix b/system/nixos/mastodon.nix index 88a461f..7fc7312 100644 --- a/system/nixos/mastodon.nix +++ b/system/nixos/mastodon.nix @@ -2,6 +2,14 @@ let web-domain = "mastodon.kempkens.io"; + + nginx-extra-proxy-settings = [ + "proxy_set_header Host $host;" + "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;" + "proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;" + "proxy_set_header X-Forwarded-Host $host;" + "proxy_set_header X-Forwarded-Server $host;" + ]; in { services.mastodon = { @@ -60,13 +68,11 @@ in extraConfig = { WEB_DOMAIN = web-domain; - LOCAL_HTTPS = "true"; }; }; services.nginx = { enable = true; - recommendedProxySettings = true; virtualHosts."${web-domain}" = { root = "${config.services.mastodon.package}/public/"; forceSSL = false; @@ -81,11 +87,13 @@ in locations."@proxy" = { proxyPass = "http://127.0.0.1:55001"; proxyWebsockets = true; + extraConfig = nginx-extra-proxy-settings; }; locations."/api/v1/streaming/" = { proxyPass = "http://127.0.0.1:55000"; proxyWebsockets = true; + extraConfig = nginx-extra-proxy-settings; }; }; };