小编tha*_*ant的帖子

无法从X-Forwarded-For获取真实用户的IP

我在单节点Kubernetes集群上运行Traefik 1.7.3,我试图从X-Forwarded-For标头中获取真实的用户IP,但是我得到的却是X-Forwarded-For: 10.244.0.1k8s集群中的IP。

这是我的Traefik部署和服务:

    ---
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: traefik-conf
    data:
      traefik.toml: |
        # traefik.toml
        debug = true
        logLevel = "DEBUG"
        defaultEntryPoints = ["http","https"]
        [entryPoints]
          [entryPoints.http]
          address = ":80"
          compress = true
          [entryPoints.http.forwardedHeaders]
          trustedIPs = [ "0.0.0.0/0" ]
          entryPoint = "https"
          [entryPoints.https]
          address = ":443"
          compress = true
          [entryPoints.https.forwardedHeaders]
          trustedIPs = [ "0.0.0.0/0" ]
          [entryPoints.https.tls]

        [acme]
        email = "xxxx"
        storage = "/acme/acme.json"
        entryPoint = "https"
        onHostRule = true
        #caServer = "https://acme-staging-v02.api.letsencrypt.org/directory"
        acmeLogging = true …
Run Code Online (Sandbox Code Playgroud)

traefik

6
推荐指数
1
解决办法
1152
查看次数

标签 统计

traefik ×1