Using the mastodon module, I’m struggling to get Traefik configured to be able to access the application. Similar to Nextcloud, the Mastodon module configures an nginx virtualhost to do all the complex routing. For Nextcloud, I was able to add a listen address to nginx and then access that via Traefik:
services.nginx.virtualHosts."nextcloud.domain.com".listen = [ { addr = "127.0.0.1"; port = 8180; } ];
.....
services.traefik.dynamicConfigOptions.http.routers.nextcloud = {
rule = "Host(`nextcloud.domain.com`)";
service = "nextcloud";
middlewares = ["headers"];
entrypoints = ["websecure"];
tls = {
certResolver = "le";
};
};
services.traefik.dynamicConfigOptions.http.services.nextcloud = {
loadBalancer = {
servers = [
{
url = "http://localhost:8180";
}
];
};
};
This works great! However, with Mastodon when I try the same method, I get the ERR_TOO_MANY_REDIRECTS error in the browser. Here is my Mastodon config:
{
lib,
...
}:{
services.mastodon = {
configureNginx = true;
enable = true;
extraConfig = {
SINGLE_USER_MODE = "true";
WEB_DOMAIN = "domain.com";
};
localDomain = "m.domain.com";
smtp.createLocally = false; # already have Postfix setup
smtp.fromAddress = "";
streamingProcesses = 3;
};
services.nginx.virtualHosts."m.domain.com" = {
enableACME = lib.mkForce false;
forceSSL = lib.mkForce false;
listen = [
{
addr = "127.0.0.1";
port = 8181;
}
];
};
services.traefik.dynamicConfigOptions.http.routers.mastodon = {
rule = "Host(`m.domain.com`)";
service = "mastodon";
middlewares = ["headers"];
entrypoints = ["websecure"];
tls = {
certResolver = "le";
};
};
services.traefik.dynamicConfigOptions.http.services.mastodon = {
loadBalancer = {
servers = [
{
url = "http://localhost:8181";
}
];
};
};
}
Any ideas? Thanks!!