feat(nixos): configure route body limits
This commit was merged in pull request #136.
This commit is contained in:
@@ -174,6 +174,7 @@
|
|||||||
domain = "files.alexion.dev";
|
domain = "files.alexion.dev";
|
||||||
protocol = "https";
|
protocol = "https";
|
||||||
port = 3923;
|
port = 3923;
|
||||||
|
clientMaxBodySize = "1g";
|
||||||
};
|
};
|
||||||
trustedSources = [ "${registry.address.${config.networking.hostName}."reverse-proxy"}/32" ];
|
trustedSources = [ "${registry.address.${config.networking.hostName}."reverse-proxy"}/32" ];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -99,6 +99,9 @@ let
|
|||||||
value = {
|
value = {
|
||||||
forceSSL = !isHttp;
|
forceSSL = !isHttp;
|
||||||
enableACME = !isHttp;
|
enableACME = !isHttp;
|
||||||
|
extraConfig = lib.optionalString (route.clientMaxBodySize != null) ''
|
||||||
|
client_max_body_size ${route.clientMaxBodySize};
|
||||||
|
'';
|
||||||
locations."/".proxyPass = mkBackend address port;
|
locations."/".proxyPass = mkBackend address port;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -29,6 +29,12 @@
|
|||||||
);
|
);
|
||||||
message = "UDP routes must set ports and not port.";
|
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 {
|
type = lib.types.submodule {
|
||||||
@@ -64,6 +70,13 @@
|
|||||||
];
|
];
|
||||||
description = "Sets the UDP ports for a UDP route.";
|
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.";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user