1
0
Fork 0

mastodon: adjust proxy config

This commit is contained in:
Daniel Kempkens 2022-11-29 16:51:16 +01:00
parent 4a028c652b
commit 60a78cf8c6
Signed by: daniel
SSH key fingerprint: SHA256:Ks/MyhQYcPRQiwMKLAKquWCdCPe3JXlb1WttgnAoSeM

View file

@ -2,6 +2,14 @@
let let
web-domain = "mastodon.kempkens.io"; 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 in
{ {
services.mastodon = { services.mastodon = {
@ -60,13 +68,11 @@ in
extraConfig = { extraConfig = {
WEB_DOMAIN = web-domain; WEB_DOMAIN = web-domain;
LOCAL_HTTPS = "true";
}; };
}; };
services.nginx = { services.nginx = {
enable = true; enable = true;
recommendedProxySettings = true;
virtualHosts."${web-domain}" = { virtualHosts."${web-domain}" = {
root = "${config.services.mastodon.package}/public/"; root = "${config.services.mastodon.package}/public/";
forceSSL = false; forceSSL = false;
@ -81,11 +87,13 @@ in
locations."@proxy" = { locations."@proxy" = {
proxyPass = "http://127.0.0.1:55001"; proxyPass = "http://127.0.0.1:55001";
proxyWebsockets = true; proxyWebsockets = true;
extraConfig = nginx-extra-proxy-settings;
}; };
locations."/api/v1/streaming/" = { locations."/api/v1/streaming/" = {
proxyPass = "http://127.0.0.1:55000"; proxyPass = "http://127.0.0.1:55000";
proxyWebsockets = true; proxyWebsockets = true;
extraConfig = nginx-extra-proxy-settings;
}; };
}; };
}; };