You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "1450793561 (via GitHub)" <gi...@apache.org> on 2025/10/15 09:26:38 UTC
[I] help request: How to set chash based on custom variables [apisix]
1450793561 opened a new issue, #12674:
URL: https://github.com/apache/apisix/issues/12674
### Description
Requirement: When configuring upstream, select chash. When configuring key, i want to set custom variables,However, the following error is prompted
```
schema validate failed: (root): Does not match pattern '^((uri|server_name|server_addr|request_uri|remote_port|remote_addr|query_string|host|hostname)|arg_[0-9a-zA-z_-]+)$'
```
### Environment
apisix version 3.9.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: notifications-unsubscribe@apisix.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] help request: How to set chash based on custom variables [apisix]
Posted by "Baoyuantop (via GitHub)" <gi...@apache.org>.
Baoyuantop closed issue #12674: help request: How to set chash based on custom variables
URL: https://github.com/apache/apisix/issues/12674
--
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] help request: How to set chash based on custom variables [apisix]
Posted by "1450793561 (via GitHub)" <gi...@apache.org>.
1450793561 commented on issue #12674:
URL: https://github.com/apache/apisix/issues/12674#issuecomment-3409735402
How can the client address obtained from http_cdn_src_ip be assigned to client_real_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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] help request: How to set chash based on custom variables [apisix]
Posted by "1450793561 (via GitHub)" <gi...@apache.org>.
1450793561 commented on issue #12674:
URL: https://github.com/apache/apisix/issues/12674#issuecomment-3409347221
Under version 3.9.1, the same error is reported when using the admin api
```
{
"error_msg": "invalid configuration: failed to match pattern \"^((uri|server_name|server_addr|request_uri|remote_port|remote_addr|query_string|host|hostname|mqtt_client_id)|arg_[0-9a-zA-z_-]+)$\" with \"client_real_ip\""
}
```
<img width="2568" height="1608" alt="Image" src="https://github.com/user-attachments/assets/4dfdb225-d18c-4303-8969-bb5763b5765e" />
--
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] help request: How to set chash based on custom variables [apisix]
Posted by "Baoyuantop (via GitHub)" <gi...@apache.org>.
Baoyuantop commented on issue #12674:
URL: https://github.com/apache/apisix/issues/12674#issuecomment-3414228468
> How can the client address obtained from http_cdn_src_ip be assigned to client_real_ip
Could you explain your intention in more detail? I don't understand.
--
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] help request: How to set chash based on custom variables [apisix]
Posted by "Baoyuantop (via GitHub)" <gi...@apache.org>.
Baoyuantop commented on issue #12674:
URL: https://github.com/apache/apisix/issues/12674#issuecomment-3405491044
Hi @1450793561, the current version is not compatible with the dashboard you are using. You can use the admin api to configure or update to the latest version. We support the built-in new dashboard in 3.13.0
--
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] help request: How to set chash based on custom variables [apisix]
Posted by "Baoyuantop (via GitHub)" <gi...@apache.org>.
Baoyuantop commented on issue #12674:
URL: https://github.com/apache/apisix/issues/12674#issuecomment-3414213865
Hi @1450793561, refer to the [admin api doc](https://apache-apisix.netlify.app/docs/apisix/3.9/admin-api/#upstream), key does not support client_real_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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] help request: How to set chash based on custom variables [apisix]
Posted by "1450793561 (via GitHub)" <gi...@apache.org>.
1450793561 commented on issue #12674:
URL: https://github.com/apache/apisix/issues/12674#issuecomment-3405483954
<img width="3175" height="528" alt="Image" src="https://github.com/user-attachments/assets/c8c39f53-56e5-4bd8-98a0-08deb23541d3" />
--
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] help request: How to set chash based on custom variables [apisix]
Posted by "1450793561 (via GitHub)" <gi...@apache.org>.
1450793561 commented on issue #12674:
URL: https://github.com/apache/apisix/issues/12674#issuecomment-3414504355
We want to calculate based on the user's real IP address when chash is selected. Our architecture is that the CDN forwards traffic to the APISIX gateway, and then the gateway proxies to the upstream. We aim to obtain the real IP address passed by the CDN on APISIX and perform the calculation based on this real IP address.
--
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] help request: How to set chash based on custom variables [apisix]
Posted by "Baoyuantop (via GitHub)" <gi...@apache.org>.
Baoyuantop commented on issue #12674:
URL: https://github.com/apache/apisix/issues/12674#issuecomment-3976591677
The `vars_combinations` pattern (introduced by Issue #3261) can serve as a workaround for current needs. Users can replace `hash_on` with `vars_combinations`, setting the key to `$client_real_ip` or `$http_cdn_src_ip`. This avoids the schema whitelist while maintaining essentially the same runtime logic as the `vars` pattern. However, fundamentally, the schema whitelist design in the `vars` pattern suffers from excessive restrictions and should be relaxed to support all valid Nginx variable names.
--
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] help request: How to set chash based on custom variables [apisix]
Posted by "1450793561 (via GitHub)" <gi...@apache.org>.
1450793561 commented on issue #12674:
URL: https://github.com/apache/apisix/issues/12674#issuecomment-3409728508
Now our requirement is to use the real ip address of the client, $http_cdn_src_ip, sent by the cdn, and then implement the hash based on the client_real_ip variable during the chash algorithm, similar to the configuration in nginx as follows
```
map $http_cdn_src_ip $client_real_ip {
"" $remote_addr;
default $http_cdn_src_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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] help request: How to set chash based on custom variables [apisix]
Posted by "1450793561 (via GitHub)" <gi...@apache.org>.
1450793561 commented on issue #12674:
URL: https://github.com/apache/apisix/issues/12674#issuecomment-3435158553
> Is this configuration possible?
>
> ```
> {
> "type": "chash",
> "hash_on": "header",
> "key": "cdn_src_ip",
> "nodes": {...}
> }
> ```
What if it is an internal network access and there is no cdn_src_ip header? Then when chash, the key value is empty
--
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] help request: How to set chash based on custom variables [apisix]
Posted by "Baoyuantop (via GitHub)" <gi...@apache.org>.
Baoyuantop commented on issue #12674:
URL: https://github.com/apache/apisix/issues/12674#issuecomment-3996129571
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] help request: How to set chash based on custom variables [apisix]
Posted by "Baoyuantop (via GitHub)" <gi...@apache.org>.
Baoyuantop commented on issue #12674:
URL: https://github.com/apache/apisix/issues/12674#issuecomment-3415223549
Is this configuration possible?
```
{
"type": "chash",
"hash_on": "header",
"key": "cdn_src_ip",
"nodes": {...}
}
```
--
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] help request: How to set chash based on custom variables [apisix]
Posted by "1450793561 (via GitHub)" <gi...@apache.org>.
1450793561 commented on issue #12674:
URL: https://github.com/apache/apisix/issues/12674#issuecomment-3409348489
3.9.1 version not support?
--
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