feat(nixos): configure route body limits #136

Merged
alexion merged 1 commits from feat/configure-proxy-body-limits into main 2026-10-06 22:57:16 -04:00
3 changed files with 17 additions and 0 deletions
Showing only changes of commit 46a47fa061 - Show all commits

View File

@@ -174,6 +174,7 @@
domain = "files.alexion.dev";
protocol = "https";
port = 3923;
clientMaxBodySize = "1g";
};
trustedSources = [ "${registry.address.${config.networking.hostName}."reverse-proxy"}/32" ];
};

View File

@@ -99,6 +99,9 @@ let
value = {
forceSSL = !isHttp;
enableACME = !isHttp;
extraConfig = lib.optionalString (route.clientMaxBodySize != null) ''
client_max_body_size ${route.clientMaxBodySize};
'';
locations."/".proxyPass = mkBackend address port;
};
};

View File

@@ -29,6 +29,12 @@
);
message = "UDP routes must set ports and not port.";
}
{
assertion =
entries:
lib.all (entry: entry.value.protocol != "udp" || entry.value.clientMaxBodySize == null) entries;
message = "UDP routes must not set clientMaxBodySize.";
}
];
type = lib.types.submodule {
@@ -64,6 +70,13 @@
];
description = "Sets the UDP ports for a UDP route.";
};
clientMaxBodySize = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
example = "1g";
description = "Maximum HTTP request body the reverse proxy accepts.";
};
};
};
}