Traefik - 不了解whitelistSourceRange

时间:2018-01-28 15:47:45

标签: docker traefik

我不明白如何使用whitelistSourceRange ... 当我使用我的公共IP设置docker标签traefik.frontend.whitelistSourceRange时,我无法访问容器。 在日志中,我们可以看到IP是私有IP ...我不知道什么? (不是ip contianer而不是我的私人ip)

time="2018-01-28T15:35:55Z" level=debug msg="source-IP 10.255.0.2 matched none of the whitelists - rejecting" 
time="2018-01-28T15:35:55Z" level=debug msg="source-IP 10.255.0.2 matched none of the whitelists - rejecting" 

有人可以帮助我吗?

感谢,

1 个答案:

答案 0 :(得分:0)

看起来你的机器和运行Traefik的Docker之间有什么东西。也许AWS中的ELB或k8s中的Ingress控制器?您需要设置一个X-Forwarded - *'标头包含您的原始IP地址,并将Traefik配置为使用转发标头。

例如:

[entryPoints.http.forwardedHeaders]
trustedIPs = ["127.0.0.1/32", "192.168.1.7"]

http://docs.traefik.io/configuration/entrypoints/#whitelisting