Merge remote-tracking branch 'refs/remotes/origin/main'

This commit is contained in:
muon 2025-05-24 09:33:02 +00:00
commit bdd3a6b8ae

View file

@ -42,46 +42,46 @@ in {
address = "0.0.0.0"; address = "0.0.0.0";
}; };
services.nginx.virtualHosts."${hostname}" = let # services.nginx.virtualHosts."${hostname}" = let
ui = "http://10.0.0.3:${toString port-ui}"; # ui = "http://10.0.0.3:${toString port-ui}";
backend = "http://10.0.0.3:${toString port}"; # backend = "http://10.0.0.3:${toString port}";
in lib.mkIf config.mods.server.nginx.enable { # in lib.mkIf config.mods.server.nginx.enable {
forceSSL = true; # forceSSL = true;
enableACME = true; # enableACME = true;
locations = { # locations = {
"~ ^/(api|pictrs|feeds|nodeinfo|.well-known)" = { # "~ ^/(api|pictrs|feeds|nodeinfo|.well-known)" = {
# backend requests # # backend requests
proxyPass = backend; # proxyPass = backend;
proxyWebsockets = true; # proxyWebsockets = true;
recommendedProxySettings = true; # recommendedProxySettings = true;
}; # };
"/" = { # "/" = {
# mixed frontend and backend requests, based on the request headers # # mixed frontend and backend requests, based on the request headers
extraConfig = '' # extraConfig = ''
set $proxpass "${ui}"; # set $proxpass "${ui}";
if ($http_accept = "application/activity+json") { # if ($http_accept = "application/activity+json") {
set $proxpass "${backend}"; # set $proxpass "${backend}";
} # }
if ($http_accept = "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"") { # if ($http_accept = "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"") {
set $proxpass "${backend}"; # set $proxpass "${backend}";
} # }
if ($request_method = POST) { # if ($request_method = POST) {
set $proxpass "${backend}"; # set $proxpass "${backend}";
} # }
# Cuts off the trailing slash on URLs to make them valid # # Cuts off the trailing slash on URLs to make them valid
rewrite ^(.+)/+$ $1 permanent; # rewrite ^(.+)/+$ $1 permanent;
proxy_pass $proxpass; # proxy_pass $proxpass;
# Proxied `Host` header is required to validate ActivityPub HTTP signatures for incoming events. # # Proxied `Host` header is required to validate ActivityPub HTTP signatures for incoming events.
# The other headers are optional, for the sake of better log data. # # The other headers are optional, for the sake of better log data.
proxy_set_header X-Real-IP $remote_addr; # proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host; # proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
''; # '';
}; # };
}; # };
}; # };
}; };
} }