feat(nginx): add extraLocations option for WebSocket support
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
a2a0dfaa58
commit
cbce4aa228
1 changed files with 29 additions and 4 deletions
|
|
@ -44,6 +44,23 @@ in
|
|||
default = "";
|
||||
description = "Extra Nginx config for this location";
|
||||
};
|
||||
extraLocations = lib.mkOption {
|
||||
type = lib.types.attrsOf (lib.types.submodule {
|
||||
options = {
|
||||
proxyPass = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Proxy target URL";
|
||||
};
|
||||
extraConfig = lib.mkOption {
|
||||
type = lib.types.lines;
|
||||
default = "";
|
||||
description = "Extra Nginx config for this location";
|
||||
};
|
||||
};
|
||||
});
|
||||
default = { };
|
||||
description = "Additional location blocks to add to this virtual host";
|
||||
};
|
||||
};
|
||||
});
|
||||
default = { };
|
||||
|
|
@ -79,10 +96,18 @@ in
|
|||
enableACME = true;
|
||||
forceSSL = true;
|
||||
|
||||
locations."/" = {
|
||||
locations = {
|
||||
"/" = {
|
||||
proxyPass = "http://127.0.0.1:${toString opts.port}";
|
||||
extraConfig = opts.extraConfig;
|
||||
};
|
||||
} // lib.mapAttrs' (locPath: locOpts: {
|
||||
name = locPath;
|
||||
value = {
|
||||
proxyPass = locOpts.proxyPass;
|
||||
extraConfig = locOpts.extraConfig;
|
||||
};
|
||||
}) opts.extraLocations;
|
||||
};
|
||||
}) cfg.domains;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue