SandNight commented on issue #11907:
URL: https://github.com/apache/apisix/issues/11907#issuecomment-2587215724
> Could be attributed to Docker networking. Please see if `real-ip` plugin
helps.
docker-compose.yml
version: "3"
services:
apisix-dashboard:
container_name: apisix-dashboard
image: apache/apisix-dashboard:3.0.1-alpine
restart: always
volumes:
-
/Users/jade/docker/apisix/dashboard_conf/conf.yaml:/usr/local/apisix-dashboard/conf/conf.yaml
ports:
- "9000:9000"
networks:
apisix:
apisix:
container_name: apisix
image: apache/apisix:v-3.11.0-x86
restart: always
volumes:
-
/Users/jade/docker/apisix/apisix_conf/config.yaml:/usr/local/apisix/conf/config.yaml:ro
ports:
- "9180:9180/tcp"
- "9080:9080/tcp"
- "9091:9091/tcp"
- "9443:9443/tcp"
- "9092:9092/tcp"
networks:
apisix:
networks:
apisix:
driver: bridge
when I try use real-ip plugin , cause an exception.
real-ip config in etcd /apisix/route/xxx
"real-ip": {
"recursive": false,
"source": "http_x_forwarded_for",
"trusted_addresses": [
"127.0.0.0/24",
"172.20.0.0/24",
"10.100.48.0/24",
"192.168.185.0/24",
"192.168.1.0/24",
"192.168.164.0/24",
"10.80.9.0/24"
]
}
apisix logs (the ip is still wrong)
2025/01/12 05:13:45 [warn] 62#62: *8866 [lua] real-ip.lua:149:
phase_func(): missing real address, client: 172.19.0.1, server: _, request:
"GET /gateway/hello HTTP/1.1", host: "192.168.26.161:9080"
172.19.0.1 - - [12/Jan/2025:05:13:45 +0000] 192.168.26.161:9080 "GET
/gateway/hello HTTP/1.1" 200 549 0.079 "-"
"PostmanRuntime-ApipostRuntime/1.1.0" 192.168.26.161:8062 200 0.078
"http://192.168.26.161:9080"
when I use the model(Client -> Nginx -> APISIX -> Upstream)
I can get the right ip with real-ip plugin
--
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]