Re: [I] X-Real-IP header not honored when set in route plugin proxy-rewrite [apisix]

2025-07-10 Thread via GitHub


Baoyuantop commented on issue #12346:
URL: https://github.com/apache/apisix/issues/12346#issuecomment-3056139373

   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] X-Real-IP header not honored when set in route plugin proxy-rewrite [apisix]

2025-07-10 Thread via GitHub


Baoyuantop closed issue #12346: X-Real-IP header not honored when set in route 
plugin proxy-rewrite
URL: https://github.com/apache/apisix/issues/12346


-- 
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] X-Real-IP header not honored when set in route plugin proxy-rewrite [apisix]

2025-06-24 Thread via GitHub


Baoyuantop commented on issue #12346:
URL: https://github.com/apache/apisix/issues/12346#issuecomment-2999091825

   Hi @liu1004010308, any updates?


-- 
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] X-Real-IP header not honored when set in route plugin proxy-rewrite [apisix]

2025-06-18 Thread via GitHub


liu1004010308 commented on issue #12346:
URL: https://github.com/apache/apisix/issues/12346#issuecomment-2986737860

   @Baoyuantop thanks, If necessary, Iโ€™ll give it a try.


-- 
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] X-Real-IP header not honored when set in route plugin proxy-rewrite [apisix]

2025-06-18 Thread via GitHub


Baoyuantop commented on issue #12346:
URL: https://github.com/apache/apisix/issues/12346#issuecomment-2986507848

   I think a custom plugin could be written to accomplish this logic. Refer to 
https://docs.api7.ai/apisix/how-to-guide/custom-plugins/create-plugin-in-lua


-- 
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] X-Real-IP header not honored when set in route plugin proxy-rewrite [apisix]

2025-06-18 Thread via GitHub


liu1004010308 commented on issue #12346:
URL: https://github.com/apache/apisix/issues/12346#issuecomment-2986383278

   @Baoyuantop thanks your answer
   But in our actual scenario, this is not reasonable!
   If I just want to pass through the real IP, how should I handle it?


-- 
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] X-Real-IP header not honored when set in route plugin proxy-rewrite [apisix]

2025-06-18 Thread via GitHub


Baoyuantop commented on issue #12346:
URL: https://github.com/apache/apisix/issues/12346#issuecomment-2986358517

   If the plugin does not read the x_real_ip header, it will print a warning 
log "missing real address" and then do nothing.
   
   But from the 
https://github.com/apache/apisix/blob/master/apisix/cli/ngx_tpl.lua#L817, it 
always adds this request header to the upstream.


-- 
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] X-Real-IP header not honored when set in route plugin proxy-rewrite [apisix]

2025-06-18 Thread via GitHub


liu1004010308 commented on issue #12346:
URL: https://github.com/apache/apisix/issues/12346#issuecomment-2984107650

   > "plugins": {
   >   "real-ip": {
   > "source": "http_x_real_ip"
   >   }
   > }
   
   @mikyll thans your answer, When I set this, if x_real_ip is empty, why does 
APISIX still pass a value for real_ip to the backend? I spent a long time 
researching this, and I feel that this feature is not very user-friendly.
   
   route๏ผš
   
{"name":"autoreg_http_yun.test1.cn_81_*_app_44665544","desc":"","enable_websocket":true,"status":1,"hosts":["yun.test1.cn"],"uris":["*"],"priority":0,"methods":["GET","POST","PUT","PATCH","OPTIONS","HEAD","DELETE","CONNECT","TRACE","PURGE"],"plugins":{"proxy-rewrite":{"headers":{"Upgrade":"$http_upgrade","Connection":"upgrade","Host":"$host","X-Forwarded-For":"$proxy_add_x_forwarded_for"},"use_real_request_uri_unsafe":true},"real-ip":{"source":
 "http_x_real_ip" 
}},"vars":[["server_port","==",81]],"upstream":{"pass_host":"pass","timeout":{"send":7200,"connect":60,"read":7200},"keepalive_pool":{"idle_timeout":60,"size":320,"requests":1000},"scheme":"http","type":"roundrobin","nodes":{"10.217.16.124:10002":50,"10.217.16.238:10002":50},"checks":{"active":{"type":"tcp","timeout":5,"concurrency":10,"http_path":"/","healthy":{"interval":2,"successes":1,"http_statuses":[200,302]},"unhealthy":{"timeouts":3,"interval":5,"http_statuses":[429,404,500,501,502,503,504,505],"http_failures":5
 
,"tcp_failures":3}},"passive":{"type":"http","healthy":{"successes":3,"http_statuses":[200,201]},"unhealthy":{"timeouts":7,"http_statuses":[500],"http_failures":3,"tcp_failures":3,"id":"00070135"}
   
   apisix logs:
   
![Image](https://github.com/user-attachments/assets/1fe20983-ad1e-4581-b174-f04129ad2d91)
   apisix output:
   
![Image](https://github.com/user-attachments/assets/1fd79b5d-0466-45e2-8a0e-3f57f0882162)
   


-- 
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] X-Real-IP header not honored when set in route plugin proxy-rewrite [apisix]

2025-06-18 Thread via GitHub


liu1004010308 commented on issue #12346:
URL: https://github.com/apache/apisix/issues/12346#issuecomment-2983263106

   @mikyll  thanks, Is this APISIX setting actually useful?
   config.yaml:
   real_ip_header: **
   real_ip_recursive: "off"
   real_ip_from: - 0.0.0.0/0 - 127.0.0.1


-- 
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] X-Real-IP header not honored when set in route plugin proxy-rewrite [apisix]

2025-06-18 Thread via GitHub


mikyll commented on issue #12346:
URL: https://github.com/apache/apisix/issues/12346#issuecomment-2983245505

   You can try to add this `real-ip` configuration to your route: 
   
   ```json
   "plugins": {
 "real-ip": {
   "source": "http_x_real_ip"
 }
   }
   ```
   
   This will mask the IP only if the header "X-Real-IP" is present. Have a look 
at NGiNX Variables (from [here](https://nginx.org/en/docs/varindex.html) and 
[**here**](https://nginx.org/en/docs/http/ngx_http_core_module.html#var_http_)).
   
   Consider setting also `trusted_addresses` if you want to allow only a 
specific set of IP addresses.


-- 
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] X-Real-IP header not honored when set in route plugin proxy-rewrite [apisix]

2025-06-18 Thread via GitHub


liu1004010308 commented on issue #12346:
URL: https://github.com/apache/apisix/issues/12346#issuecomment-2983039929

   @mikyll thanks your answer
   My requirement is:
   
   There are multiple layers of proxies in front.
   If the immediate upstream proxy includes a Real-IP header, I want to 
directly inherit and use it.
   If the upstream proxy does not include the Real-IP header, then I don't want 
to pass or set it.
   
   How can this be achieved?


-- 
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] X-Real-IP header not honored when set in route plugin proxy-rewrite [apisix]

2025-06-18 Thread via GitHub


mikyll commented on issue #12346:
URL: https://github.com/apache/apisix/issues/12346#issuecomment-2983007114

   Exactly, I have to check, but probably setting the header from proxy-rewrite 
is done later than the NGiNX module handling X-Real-Ip header ๐Ÿ™‚ 


-- 
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] X-Real-IP header not honored when set in route plugin proxy-rewrite [apisix]

2025-06-18 Thread via GitHub


liu1004010308 commented on issue #12346:
URL: https://github.com/apache/apisix/issues/12346#issuecomment-2982996794

   > I think you should use 
[real-ip](https://apisix.apache.org/docs/apisix/plugins/real-ip/) plugin for 
this purpose ๐Ÿ‘€
   
   @mikyll thanks your answer 
   X-Real-IP  in   plugins-->proxy-rewrite--> headers is unuseful?
   
   


-- 
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] X-Real-IP header not honored when set in route plugin proxy-rewrite [apisix]

2025-06-18 Thread via GitHub


mikyll commented on issue #12346:
URL: https://github.com/apache/apisix/issues/12346#issuecomment-2982954262

   I think you should use 
[real-ip](https://apisix.apache.org/docs/apisix/plugins/real-ip/) plugin for 
this purpose ๐Ÿ‘€ 


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