spacewander commented on issue #4470:
URL: https://github.com/apache/apisix/issues/4470#issuecomment-867273669


   Interesting. I try it locally but can't reproduce it. Here is my route:
   ```
   {
    "uri": "/xff",
    "plugins": {
       "proxy-rewrite": {
         "disable": false,
         "headers": {
           "ENV": "pre",
           "Host": "$host",
           "X-Forwarded-For": "$proxy_add_x_forwarded_for"
         },
         "regex_uri": [
           "/api/scrm/(.*)",
           "/common-rest/$1"
         ]
       }
     },
     "upstream": {
       "type": "roundrobin",
       "nodes": {
        "127.0.0.1:1980": 1
       }
     }
   }
   ```
   
   Here is how I try
   ```bash
    ¥ curl http://127.0.0.1:9080/xff -i
   HTTP/1.1 200 OK
   Content-Type: text/plain; charset=utf-8
   Transfer-Encoding: chunked
   Connection: keep-alive
   Date: Thu, 24 Jun 2021 01:55:52 GMT
   Server: APISIX/2.6
   
   uri: /xff
   accept: */*
   env: pre
   host: 127.0.0.1:9080
   user-agent: curl/7.68.0
   x-forwarded-for: 127.0.0.1
   x-forwarded-host: 127.0.0.1
   x-forwarded-port: 9080
   x-forwarded-proto: http
   x-real-ip: 127.0.0.1
   
    ¥ curl http://127.0.0.1:9080/xff -i -H "X-Forwarded-For: 220.249.1.1"
   HTTP/1.1 200 OK
   Content-Type: text/plain; charset=utf-8
   Transfer-Encoding: chunked
   Connection: keep-alive
   Date: Thu, 24 Jun 2021 01:56:35 GMT
   Server: APISIX/2.6
   
   uri: /xff
   accept: */*
   env: pre
   host: 127.0.0.1:9080
   user-agent: curl/7.68.0
   x-forwarded-for: 220.249.1.1, 127.0.0.1
   x-forwarded-host: 127.0.0.1
   x-forwarded-port: 9080
   x-forwarded-proto: http
   x-real-ip: 127.0.0.1
   ```
   
   The `x-forwarded-for` is never null.
   
   Can you provide a packet capture file to see if x-forwarded-for is missing?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to