oddwill
1
Hello,
Is it possible to grab an IP address from query param and use it down the line as a server url in a service?
Something similar to:
http:
routers:
rpi:
entryPoints:
- "https"
rule: "Host(`rpi.local`) && Query(`rpiaddr=10.10.10.1`)"
service: rpi-svc
tls:
options: tlsopt
rpi-svc:
loadBalancer:
servers:
- url: "http://{QUERY_PARAM_ADDR}:2133"
Is it possible to use variables of any sort in the file config?
Thanks,
ldez
2
Hello,
you cannot do that (and it's really insecure) but you can do that:
http:
routers:
{{ range $i, $e := until 100 }}
rpi-{{ $e }}:
entryPoints:
- websecure
rule: Host(`rpi.local`) && Query(`rpiaddr=10.10.10.{{ $e }}`)
service: rpi-svc-{{ $e }}
# tls:
# options: tlsopt
{{ end }}
services:
{{ range $i, $e := until 100 }}
rpi-svc-{{ $e }}:
loadBalancer:
servers:
- url: http://10.10.10.{{ $e }}:2133
{{ end }}
oddwill
3
Thanks for the heads up!
Can you elaborate why this is insecure?
ldez
4