Re: [I] help request: remote_addr is error [apisix]
DearMisaki commented on issue #11907: URL: https://github.com/apache/apisix/issues/11907#issuecomment-3536184869 ``` apisix: .. nginx_config: http: real_ip_header: X-Forwarded-For real_ip_recursive: "off" real_ip_from: - 0.0.0.0/0 ``` Add these lines to apisix config.yaml will help you. -- 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]
Re: [I] help request: remote_addr is error [apisix]
Baoyuantop closed issue #11907: help request: remote_addr is error URL: https://github.com/apache/apisix/issues/11907 -- 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]
Re: [I] help request: remote_addr is error [apisix]
Baoyuantop commented on issue #11907: URL: https://github.com/apache/apisix/issues/11907#issuecomment-2896469967 If there is still a problem, please open it again. -- 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]
Re: [I] help request: remote_addr is error [apisix]
SandNight commented on issue #11907: URL: https://github.com/apache/apisix/issues/11907#issuecomment-2591786244 > [@SandNight](https://github.com/SandNight) I had a similar issue and adding the below apisix configuration in the httpSrv block of the nginx fixed the issue for me. set_real_ip_from 0.0.0.0/0; real_ip_header X-Forwarded-For; real_ip_recursive on; > > Full block of code example: (line 476,477,478) > > https://private-user-images.githubusercontent.com/74243900/403077132-95d98456-9ea7-408e-8563-a4a0dec49bc8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzY5MDU0NTcsIm5iZiI6MTczNjkwNTE1NywicGF0aCI6Ii83NDI0MzkwMC80MDMwNzcxMzItOTVkOTg0NTYtOWVhNy00MDhlLTg1NjMtYTRhMGRlYzQ5YmM4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAxMTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMTE1VDAxMzkxN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTNkNDBjMDlmZjNiODU4N2UxYjUwZDc1MmM4NDdkODg0Zjc5MzYzZDgzZmRlZDVjNmUzNzVkOWMwMDY2OWNhMDUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.lhil4mky4rVBB9WEafc2jwn51S9hCDwsaJ4vn-EtZyc";> thank you! I tried 3 different config in apisix(3.11) config.yaml 1. nginx_config: # Config for render the template to generate nginx.conf configurationSnippet: main: | httpStart: | httpEnd: | httpSrv: | set_real_ip_from 0.0.0.0/0; real_ip_header X-Forwarded-For; real_ip_recursive on; 2. nginx_config: # Config for render the template to generate nginx.conf http: real_ip_recursive: "on" real_ip_header: X-Forwarded_For real_ip_from: - 0.0.0.0/0 3. nginx: configurationSnippet: main: | httpStart: | httpEnd: | httpSrv: | set_real_ip_from 0.0.0.0/0; real_ip_header X-Forwarded-For; real_ip_recursive on; None of them can get the correct ip -- 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]
Re: [I] help request: remote_addr is error [apisix]
supreethmohan commented on issue #11907: URL: https://github.com/apache/apisix/issues/11907#issuecomment-2590728822 @SandNight I had a similar issue and adding the below apisix configuration in the httpSrv block of the nginx fixed the issue for me. set_real_ip_from 0.0.0.0/0; real_ip_header X-Forwarded-For; real_ip_recursive on; Full block of code example: (line 476,477,478) https://github.com/user-attachments/assets/95d98456-9ea7-408e-8563-a4a0dec49bc8"; /> -- 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]
Re: [I] help request: remote_addr is error [apisix]
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 +] 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]
Re: [I] help request: remote_addr is error [apisix]
kayx23 commented on issue #11907: URL: https://github.com/apache/apisix/issues/11907#issuecomment-2586230503 Could be attributed to Docker networking. Please see if `real-ip` plugin helps. -- 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]
