feat(nginx): add extraLocations option for WebSocket support

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
ashisgreat22 2026-03-18 03:19:31 +01:00
parent a2a0dfaa58
commit cbce4aa228

View file

@ -44,6 +44,23 @@ in
default = ""; default = "";
description = "Extra Nginx config for this location"; 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 = { }; default = { };
@ -79,10 +96,18 @@ in
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
locations."/" = { locations = {
proxyPass = "http://127.0.0.1:${toString opts.port}"; "/" = {
extraConfig = opts.extraConfig; 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; }) cfg.domains;
}; };