apisix
apisix copied to clipboard
help request: whether apisix supports changing http host before the access phase ?
Description
Currently, I have configured the routing and forwarding rules in apisix just like:
host: api.test.com
path: /v1/verify
it works well. But the demand I received later is to add a lot of domain , and we have a lot of routing rules like this, it is impossible to change one by one.
so, in order to avoid the 404 problem of route matching, is it possible to change the host passed by http to a specified host like api.test.com before the access phase(or more accurately: before routes match)?
Environment
- APISIX version (run
apisix version): - Operating system (run
uname -a): - OpenResty / Nginx version (run
openresty -Vornginx -V): - etcd version, if relevant (run
curl http://127.0.0.1:9090/v1/server_info): - APISIX Dashboard version, if relevant:
- Plugin runner version, for issues related to plugin runners:
- LuaRocks version, for installation issues (run
luarocks --version):
@zuiyangqingzhou Hi, you can add hosts attribute in service, https://apisix.apache.org/zh/blog/2021/09/29/release-apache-apisix-2.10/#%E6%96%B0%E5%8A%9F%E8%83%BDservice-%E5%A2%9E%E5%8A%A0-hosts-%E5%B1%9E%E6%80%A7
@zuiyangqingzhou Hi, you can add hosts attribute in service, https://apisix.apache.org/zh/blog/2021/09/29/release-apache-apisix-2.10/#%E6%96%B0%E5%8A%9F%E8%83%BDservice-%E5%A2%9E%E5%8A%A0-hosts-%E5%B1%9E%E6%80%A7
Thanks for your reply, but this should not meet my requirements, I need to change the host before route matching occurs.
it works well. But the demand I received later is to add a lot of domain , and we have a lot of routing rules like this, it is impossible to change one by one.
Jump from yourself option. The root problem is you have to change a lot of hosts in every routes. So try to put the hosts field to the service object and bind routes to it.
it works well. But the demand I received later is to add a lot of domain , and we have a lot of routing rules like this, it is impossible to change one by one.
Jump from yourself option. The root problem is you have to change a lot of hosts in every routes. So try to put the
hostsfield to the service object and bind routes to it.
However, we did a lot of custom development, and the service object was weakened in our system.
Is there any other way to change the host before the route matches?
it works well. But the demand I received later is to add a lot of domain , and we have a lot of routing rules like this, it is impossible to change one by one.
Jump from yourself option. The root problem is you have to change a lot of hosts in every routes. So try to put the
hostsfield to the service object and bind routes to it.However, we did a lot of custom development, and the service object was weakened in our system.
Is there any other way to change the host before the route matches?
Inject your own Nginx directives.
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 [email protected] list. Thank you for your contributions.
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.