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 2022/08/17 02:22:50 UTC
[GitHub] [apisix] exotfboy opened a new issue, #7709: help request: Host is not rewritten
exotfboy opened a new issue, #7709:
URL: https://github.com/apache/apisix/issues/7709
### Description
I tried to test APISIX by using `httpbin` as a back-end service. For client request `http://localhost:9080/get?type=six`, what I got:
```
{
"args": {
"type": "six"
},
"headers": {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "en-US,en;q=0.9",
"Cache-Control": "max-age=0",
"Cookie": "adminer_key=8a4f998dae1c2f0ab2486a43e69197f7; adminer_permanent=; adminer_lang=zh; adminer_sid=bf5aad5b4e328321bb4dca5c67c66d18; session=xxx",
"Host": "localhost",
"Sec-Ch-Ua": "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"104\"",
"Sec-Ch-Ua-Mobile": "?0",
"Sec-Ch-Ua-Platform": "\"Linux\"",
"Sec-Fetch-Dest": "document",
"Sec-Fetch-Mode": "navigate",
"Sec-Fetch-Site": "none",
"Sec-Fetch-User": "?1",
"Upgrade-Insecure-Requests": "1",
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.79 Safari/537.36",
"X-Amzn-Trace-Id": "Root=1-62fc4e4d-05c9f7de59712888753f8e41",
"X-Forwarded-Host": "localhost"
},
"origin": "172.20.0.1, xxx.xxx.xxx.xxx",
"url": "http://localhost/get?type=six"
}
```
Note that the response url is `http://localhost/get?type=six` which is not exactly the same as the request. Is this expected?
### Environment
- APISIX version (run `apisix version`): `2.15.0`
- Operating system (run `uname -a`): `Linux pc 5.4.0-84-generic #94~18.04.1-Ubuntu`
- etcd version, if relevant (run `curl http://127.0.0.1:9090/v1/server_info`):`34.0`
- APISIX Dashboard version, if relevant: `2.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.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] tokers commented on issue #7709: help request: Host is not rewritten
Posted by GitBox <gi...@apache.org>.
tokers commented on issue #7709:
URL: https://github.com/apache/apisix/issues/7709#issuecomment-1217729993
This is because the `X-Forwarded-Host` passed by `Traefik` is `localhost:88` While it's `localhost` in Apache APISIX .
--
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
[GitHub] [apisix] exotfboy commented on issue #7709: help request: Host is not rewritten
Posted by GitBox <gi...@apache.org>.
exotfboy commented on issue #7709:
URL: https://github.com/apache/apisix/issues/7709#issuecomment-1218852092
@tokers Thanks for your attention. And it is clear now:
Traefik send both the origin host and port in `X-Forwarded-Host`.
APISIX send the `host` by `X-Forwarded-Host` and `port` by `X-Forwarded-Port` to the backend while httpbin ignore the port.
So the problem is should the `X-Forwarded-Host` contain the `port` part. I think so. As the MDN said in https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Host
> The `Host` request header specifies the host and port number of the server to which the request is being sent.
--
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
[GitHub] [apisix] github-actions[bot] commented on issue #7709: help request: Host is not rewritten
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #7709:
URL: https://github.com/apache/apisix/issues/7709#issuecomment-1665358780
This issue has been marked as stale due to 350 days of inactivity. It will be closed in 2 weeks if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.
--
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
[GitHub] [apisix] exotfboy commented on issue #7709: help request: Host is not rewritten
Posted by GitBox <gi...@apache.org>.
exotfboy commented on issue #7709:
URL: https://github.com/apache/apisix/issues/7709#issuecomment-1217446407
@tzssangglass `80` is the default web port or you can think `httpbin.org:80`/get is the same as `httpbin.org/get`. But in my example, the request and response url are two absolutely different url.
--
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
[GitHub] [apisix] tzssangglass commented on issue #7709: help request: Host is not rewritten
Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #7709:
URL: https://github.com/apache/apisix/issues/7709#issuecomment-1217418208
see:
```
curl http://httpbin.org:80/get
{
"args": {},
"headers": {
"Accept": "*/*",
"Host": "httpbin.org",
"User-Agent": "curl/7.84.0",
"X-Amzn-Trace-Id": "Root=1-62fc608f-7400b47e0df9164813ce5689"
},
"origin": "xxxxx",
"url": "http://httpbin.org/get"
}
```
the port `80` is ignored by httpbin.
--
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
[GitHub] [apisix] tokers commented on issue #7709: help request: Host is not rewritten
Posted by GitBox <gi...@apache.org>.
tokers commented on issue #7709:
URL: https://github.com/apache/apisix/issues/7709#issuecomment-1217384417
@exotfboy Try to find documents about how httpbin concates the `url`.
--
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
[GitHub] [apisix] github-actions[bot] commented on issue #7709: help request: Host is not rewritten
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #7709:
URL: https://github.com/apache/apisix/issues/7709#issuecomment-1684909929
This issue has been closed due to lack of activity. If you think that is incorrect, or the issue requires additional review, you can revive the issue at any time.
--
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
[GitHub] [apisix] tokers commented on issue #7709: help request: Host is not rewritten
Posted by GitBox <gi...@apache.org>.
tokers commented on issue #7709:
URL: https://github.com/apache/apisix/issues/7709#issuecomment-1217732881
Actually, Apache APISIX will also add the `X-Forwarded-Port` header, but it's not shown by HTTPBIN, I guess it was concealed by AWS.
--
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
[GitHub] [apisix] tokers commented on issue #7709: help request: Host is not rewritten
Posted by GitBox <gi...@apache.org>.
tokers commented on issue #7709:
URL: https://github.com/apache/apisix/issues/7709#issuecomment-1218900732
I think so.
--
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
[GitHub] [apisix] exotfboy commented on issue #7709: help request: Host is not rewritten
Posted by GitBox <gi...@apache.org>.
exotfboy commented on issue #7709:
URL: https://github.com/apache/apisix/issues/7709#issuecomment-1217408461
I tried `traefid` too, and get the desired result:
![image](https://user-images.githubusercontent.com/16457917/185026393-e4091d97-210e-4355-91ab-be8cec75371f.png)
Maybe this has nothing to do with how httpbin concating the `url` but how the api gateway forward the request.
--
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
[GitHub] [apisix] tokers commented on issue #7709: help request: Host is not rewritten
Posted by GitBox <gi...@apache.org>.
tokers commented on issue #7709:
URL: https://github.com/apache/apisix/issues/7709#issuecomment-1217730783
See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] github-actions[bot] closed issue #7709: help request: Host is not rewritten
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed issue #7709: help request: Host is not rewritten
URL: https://github.com/apache/apisix/issues/7709
--
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