mscb402 commented on issue #9494:
URL: https://github.com/apache/apisix/issues/9494#issuecomment-1551039427

   I believe this may be a bug with httpbin. Firstly, it seems that you are 
sending the wrong header - it should be `x-forwarded-for`, not 
`x_forwarded_for`. However, it appears that httpbin is still able to process 
the `x_forwarded_for` header for the sake of compatibility. It seems possible 
that there is a bug related to this compatibility feature. As a solution, you 
could try the following: 
   ```
   curl http://httpbin.org/anything -H "x-forwarded-for: 1.2.3.111" -v -H 
'x_forwarded_for: 1.1.1.1'
   ```
   Send request without to APISIX. And you will get the same result below:
   ```
   *   Trying 54.173.69.67:80...
   * Connected to httpbin.org (54.173.69.67) port 80 (#0)
   > GET /anything HTTP/1.1
   > Host: httpbin.org
   > User-Agent: curl/7.74.0
   > Accept: */*
   > x-forwarded-for: 1.2.3.111
   > x_forwarded_for: 1.1.1.1
   >
   * Mark bundle as not supporting multiuse
   < HTTP/1.1 200 OK
   < Date: Wed, 17 May 2023 09:10:57 GMT
   < Content-Type: application/json
   < Content-Length: 361
   < Connection: keep-alive
   < Server: gunicorn/19.9.0
   < Access-Control-Allow-Origin: *
   < Access-Control-Allow-Credentials: true
   <
   {
     "args": {},
     "data": "",
     "files": {},
     "form": {},
     "headers": {
       "Accept": "*/*",
       "Host": "httpbin.org",
       "User-Agent": "curl/7.74.0",
       "X-Amzn-Trace-Id": "Root=1-64649a1f-23d29ac7700c8fc15eac7054"
     },
     "json": null,
     "method": "GET",
     "origin": "1.2.3.111, 61.232.56.241,1.1.1.1",
     "url": "http://httpbin.org/anything";
   }
   ```


-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to