From 611f4847de16748192a5103dacc15f2657c55fc6 Mon Sep 17 00:00:00 2001 From: Niklas Korz Date: Thu, 16 Jan 2025 11:14:44 +0100 Subject: [PATCH] nixos/mobilizon: update nginx config --- nixos/modules/services/web-apps/mobilizon.nix | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/nixos/modules/services/web-apps/mobilizon.nix b/nixos/modules/services/web-apps/mobilizon.nix index d70c50d981de..e64fb3766522 100644 --- a/nixos/modules/services/web-apps/mobilizon.nix +++ b/nixos/modules/services/web-apps/mobilizon.nix @@ -424,34 +424,35 @@ in virtualHosts."${hostname}" = { enableACME = lib.mkDefault true; forceSSL = lib.mkDefault true; - extraConfig = '' - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - ''; locations."/" = { inherit proxyPass; + proxyWebsockets = true; + recommendedProxySettings = lib.mkDefault true; + extraConfig = '' + expires off; + add_header Cache-Control "public, max-age=0, s-maxage=0, must-revalidate" always; + ''; }; - locations."~ ^/(js|css|img)" = { + locations."~ ^/(assets|img)" = { root = "${cfg.package}/lib/mobilizon-${cfg.package.version}/priv/static"; extraConfig = '' - etag off; access_log off; - add_header Cache-Control "public, max-age=31536000, immutable"; + add_header Cache-Control "public, max-age=31536000, s-maxage=31536000, immutable"; ''; }; locations."~ ^/(media|proxy)" = { inherit proxyPass; + recommendedProxySettings = lib.mkDefault true; + # Combination of HTTP/1.1 and disabled request buffering is + # needed to directly forward chunked responses extraConfig = '' - etag off; + proxy_http_version 1.1; + proxy_request_buffering off; access_log off; - add_header Cache-Control "public, max-age=31536000, immutable"; + add_header Cache-Control "public, max-age=31536000, s-maxage=31536000, immutable"; ''; }; + }; };