tzssangglass commented on issue #6648:
URL: https://github.com/apache/apisix/issues/6648#issuecomment-1072132860
my reproduction steps
1. nginx.conf
```nginx
server {
listen 80;
server_name apigw-dev.com;
location / {
proxy_pass http://0.0.0.0:9080; # APISIX admin API
proxy_set_header Host $host; # pass Host header to upstream,
it's important
root /home/application;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
```
2. route config
```shell
$ curl --location --request PUT 'http://127.0.0.1:9080/apisix/admin/routes/'
\
--header 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' \
--header 'Content-Type: application/json' \
--data-raw '{
"id": "sanctions",
"name": "sanctions",
"methods": [
"GET",
"POST",
"PUT"
],
"host": "uat-sanctions-api.com",
"uri": "/*",
"upstream": {
"type": "roundrobin",
"nodes": {
"httpbin.org:80": 1
}
}
}'
```
3. test
```shell
curl --location --request GET 'http://apigw-dev.com/get' \
--resolve 'apigw-dev.com:80:127.0.0.1' \
--header 'Host: uat-sanctions-api.com'
```
Since you set the host match in the APISIX route via `"host":
"uat-sanctions-api.com"`, but your nginx does not pass the `Host` in the client
request header, you need to add `proxy_set_header Host $host;`
--
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]