You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/03/17 15:21:02 UTC
[GitHub] [apisix] Firstsawyou commented on issue #3851: bug: traffic-split插件里的upstrem配置rewrite和upstrem_host,没有正确生效
Firstsawyou commented on issue #3851:
URL: https://github.com/apache/apisix/issues/3851#issuecomment-801170246
The current plugin only supports the pass_host operation when the upstream node is a domain name. If the upstream node is IP, the pass_host operation is not performed. Please refer here: https://github.com/apache/apisix/blob/master/apisix/plugins/traffic-split.lua#L151-L152
Example:
```shell
curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"uri": "/route01",
"plugins": {
"traffic-split": {
"rules": [
{
"match": [
{
"vars": [
["http_username", "==", "test"]
]
}
],
"weighted_upstreams": [
{
"upstream": {
"type": "roundrobin",
"pass_host": "rewrite",
"upstream_host": "echo-headers.pro.test-k8s.qslocal.com",
"nodes": {
"localhost:1990":1
}
}
}
]
}
]
}
},
"upstream": {
"type": "roundrobin",
"nodes": {
"127.0.0.1:1980":1
}
}
}'
```
```shell
curl http://127.0.0.1:9080/route01 -H 'username:test'
request_uri: /route01
x-real-ip: ::1
x-forwarded-for: ::1
x-forwarded-proto: http
x-forwarded-host: localhost
x-forwarded-port: 9080
host: echo-headers.pro.test-k8s.qslocal.com
accept: */*
username: test
user-agent: curl/7.29.0
```
It seems that the plugin needs to support the situation where the upstream node is 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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org