mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 16:21:34 +01:00
caddy: Fix extraReverseProxyConfig option
This commit is contained in:
parent
d4f66865eb
commit
533f67e14b
1 changed files with 9 additions and 2 deletions
|
|
@ -23,12 +23,19 @@ let
|
||||||
getSubdomain = domain: domain |> lib.splitString "." |> lib.head;
|
getSubdomain = domain: domain |> lib.splitString "." |> lib.head;
|
||||||
|
|
||||||
mkVirtualHostConfig =
|
mkVirtualHostConfig =
|
||||||
{ domain, port, ... }:
|
{
|
||||||
|
domain,
|
||||||
|
port,
|
||||||
|
extraReverseProxyConfig,
|
||||||
|
...
|
||||||
|
}:
|
||||||
{
|
{
|
||||||
logFormat = "output file ${config.services.caddy.logDir}/access-${domain}.log { mode 640 }";
|
logFormat = "output file ${config.services.caddy.logDir}/access-${domain}.log { mode 640 }";
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
${lib.optionalString (isTailscaleDomain domain) "bind tailscale/${getSubdomain domain}"}
|
${lib.optionalString (isTailscaleDomain domain) "bind tailscale/${getSubdomain domain}"}
|
||||||
reverse_proxy localhost:${builtins.toString port}
|
reverse_proxy localhost:${builtins.toString port} ${
|
||||||
|
lib.optionalString (extraReverseProxyConfig != "") "{ ${extraReverseProxyConfig} }"
|
||||||
|
}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue