You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "caibirdme (via GitHub)" <gi...@apache.org> on 2023/11/17 03:44:48 UTC
[I] feat: As a user, I want to ip-restriction support read ip from header [apisix]
caibirdme opened a new issue, #10510:
URL: https://github.com/apache/apisix/issues/10510
### Description
As a user, I want to ip-restriction support read ip from request header like x-forward-for or any other cloud LB defined header.
Case:
Our apisix is deployed behind the [tencent edgeone](https://www.tencentcloud.com/zh/products/teo), which is an edge acceleration platform. It will set the original client ip in the header EO-CON-IP. The apisix ip-restriction plugin only reads ip from var.remote_addr, thus we cannot use the ip whilte list function.
I hope that ip-restriction plugin could support config like:
```yaml
ip-restriction:
whitelist: [1.2.3.4. 2.3.4.5]
ip_in_header: X-Forward-For # or any other custom 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: notifications-unsubscribe@apisix.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] feat: As a user, I want ip-restriction could support read ip from header [apisix]
Posted by "caibirdme (via GitHub)" <gi...@apache.org>.
caibirdme closed issue #10510: feat: As a user, I want ip-restriction could support read ip from header
URL: https://github.com/apache/apisix/issues/10510
--
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] feat: As a user, I want ip-restriction could support read ip from header [apisix]
Posted by "caibirdme (via GitHub)" <gi...@apache.org>.
caibirdme commented on issue #10510:
URL: https://github.com/apache/apisix/issues/10510#issuecomment-1818953678
After reading the docs about nginx, I achieved this goal successfully.
In nginx, you can use `arg_xxx` to access xxx in query param and `http_xxx` to access xxx in header. [here's the nginx doc](https://nginx.org/en/docs/http/ngx_http_core_module.html#var_http_)
So we can config real-ip like this:
```yaml
plugins:
real-ip:
source: http_x_my_custom_header # ctx.var.remote_addr = header['X-My-Custom-Header']
ip-restriction:
whitelist: ["a.b.c.d"] # ctx.var.remote_addr in ["a.b.c.d"]
```
--
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] feat: As a user, I want ip-restriction could support read ip from header [apisix]
Posted by "shreemaan-abhishek (via GitHub)" <gi...@apache.org>.
shreemaan-abhishek commented on issue #10510:
URL: https://github.com/apache/apisix/issues/10510#issuecomment-1816139022
I think you can use ip-restriction along with the real-ip plugin:
https://docs.api7.ai/hub/real-ip#obtain-real-client-address-from-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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] feat: As a user, I want ip-restriction could support read ip from header [apisix]
Posted by "caibirdme (via GitHub)" <gi...@apache.org>.
caibirdme commented on issue #10510:
URL: https://github.com/apache/apisix/issues/10510#issuecomment-1818166192
real-ip only supports read data from ngx variables and X-Forward-For header, but I want to read from other http headers
--
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org