reverse proxy stuff
This commit is contained in:
@@ -12,6 +12,14 @@ let
|
||||
hostAddress = "10.0.1.3";
|
||||
actualUserId = config.users.users.nix-apps.uid;
|
||||
actualGroupId = config.users.groups.jallen-nas.gid;
|
||||
|
||||
# Create reverse proxy configuration using mkReverseProxy
|
||||
reverseProxyConfig = lib.${namespace}.mkReverseProxy {
|
||||
name = "actual";
|
||||
subdomain = cfg.reverseProxy.subdomain;
|
||||
url = "http://${cfg.localAddress}:${toString cfg.port}";
|
||||
middlewares = cfg.reverseProxy.middlewares;
|
||||
};
|
||||
in
|
||||
{
|
||||
imports = [ ./options.nix ];
|
||||
@@ -98,19 +106,23 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
services.traefik.dynamicConfigOptions = lib.mkIf cfg.reverseProxy.enable {
|
||||
services.actual.loadBalancer.servers = [
|
||||
{
|
||||
url = "http://${cfg.localAddress}:${toString cfg.port}";
|
||||
}
|
||||
];
|
||||
routers.actual = {
|
||||
entryPoints = [ "websecure" ];
|
||||
rule = "Host(`${cfg.reverseProxy.host}`)";
|
||||
service = "actual";
|
||||
middlewares = cfg.reverseProxy.middlewares;
|
||||
tls.certResolver = "letsencrypt";
|
||||
};
|
||||
# services.traefik.dynamicConfigOptions = lib.mkIf cfg.reverseProxy.enable {
|
||||
# services.actual.loadBalancer.servers = [
|
||||
# {
|
||||
# url = "http://${cfg.localAddress}:${toString cfg.port}";
|
||||
# }
|
||||
# ];
|
||||
# routers.actual = {
|
||||
# entryPoints = [ "websecure" ];
|
||||
# rule = "Host(`${cfg.reverseProxy.host}`)";
|
||||
# service = "actual";
|
||||
# middlewares = cfg.reverseProxy.middlewares;
|
||||
# tls.certResolver = "letsencrypt";
|
||||
# };
|
||||
# };
|
||||
|
||||
${namespace}.services.traefik = lib.mkIf cfg.reverseProxy.enable {
|
||||
reverseProxies = [ reverseProxyConfig ];
|
||||
};
|
||||
|
||||
networking = {
|
||||
|
||||
Reference in New Issue
Block a user