{
	https_port 8443
	http_port 8880
	servers {
		protocols h1 h2
	}
}

# Authelia endpoint (no forward_auth on itself)
auth.jimmygan.com {
	tls {
		dns cloudflare {env.CLOUDFLARE_API_TOKEN}
	}
	reverse_proxy localhost:9092
}

# Protected services with forward_auth
nas.jimmygan.com {
	tls {
		dns cloudflare {env.CLOUDFLARE_API_TOKEN}
	}
	forward_auth localhost:9092 {
		uri /api/verify?rd=https://auth.jimmygan.com:8443
		copy_headers Remote-User Remote-Groups Remote-Name Remote-Email
	}
	reverse_proxy localhost:4000
}

music.jimmygan.com {
	tls {
		dns cloudflare {env.CLOUDFLARE_API_TOKEN}
	}
	forward_auth localhost:9092 {
		uri /api/verify?rd=https://auth.jimmygan.com:8443
		copy_headers Remote-User Remote-Groups Remote-Name Remote-Email
	}
	reverse_proxy localhost:4533 {
		flush_interval -1
	}
}

n8n.jimmygan.com {
	tls {
		dns cloudflare {env.CLOUDFLARE_API_TOKEN}
	}
	forward_auth localhost:9092 {
		uri /api/verify?rd=https://auth.jimmygan.com:8443
		copy_headers Remote-User Remote-Groups Remote-Name Remote-Email
	}
	reverse_proxy localhost:5678
}

ldap.jimmygan.com {
        tls {
                dns cloudflare {env.CLOUDFLARE_API_TOKEN}
        }
        forward_auth localhost:9092 {
                uri /api/verify?rd=https://auth.jimmygan.com:8443
                copy_headers Remote-User Remote-Groups Remote-Name Remote-Email
        }
        reverse_proxy localhost:17170
}

git.jimmygan.com {
        tls {
                dns cloudflare {env.CLOUDFLARE_API_TOKEN}
        }
        forward_auth localhost:9092 {
                uri /api/verify?rd=https://auth.jimmygan.com:8443
                copy_headers Remote-User Remote-Groups Remote-Name Remote-Email
        }
        reverse_proxy localhost:3300
}
