Allow setting trusted proxies per entrypoint

This commit is contained in:
Daniel Berteaud 2024-02-18 22:46:32 +01:00
parent 4ead786c8f
commit 1ee95c47a1
2 changed files with 7 additions and 2 deletions

View File

@ -2,6 +2,7 @@ job "traefik" {
datacenters = ["dc1"]
region = "global"
priority = 70

View File

@ -15,9 +15,13 @@ entryPoints:
[[- if or (not (has $def "enabled")) ($def.enabled) ]]
[[ $name ]]:
address: ":{{ env "NOMAD_PORT_[[ $name | regexp.Replace "[\\.\\-]" "_" ]]" }}[[ if has $def "protocol" ]]/[[ $def.protocol ]][[ end ]]"
[[- if gt (len $.traefik.trusted_proxies) 0 ]]
[[- $trusted_proxies := $.traefik.trusted_proxies ]]
[[- if has $def "trusted_proxies" ]]
[[- $trusted_proxies = $def.trusted_proxies ]]
[[- end ]]
[[- if gt (len $trusted_proxies) 0 ]]
proxyProtocol:
trustedIPs:[[ range $idx, $ip := $.traefik.trusted_proxies ]]
trustedIPs:[[ range $idx, $ip := $trusted_proxies ]]
- [[ $ip ]][[ end ]]
[[- end ]]
[[- if has $def "http" ]]