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/05/07 09:59:46 UTC

[GitHub] [apisix] Gary-Airwallex opened a new issue #4197: request help: set different Host header for different Nodes in a single Upstream?

Gary-Airwallex opened a new issue #4197:
URL: https://github.com/apache/apisix/issues/4197


   ### Issue description
   APISIX supports rewriting of Host header while talking to the upstream nodes, either with the proxy-rewrite plugin or with "pass_host" and "upstream_host" attributes in Upstream configuration. However, they both rewrite host for the Upstream, not nodes - so for example if I have an upstream with nodes: 
   ```
   "nodes": {
       "host-1.com:80": 1,
       "host-2.com:443": 1
   }, 
   ```
   I can't set Host to "host-1.com" when the first node is picked by the balancer, and set Host to "host-2.com" when the second is picked. I have tried ngx.req.set_header() or set the upstream_host variable in balancer phase directly and they don't seem to work. Is it a constraint by nginx modules / openresty? 
   
   ### Environment
   
   * apisix version (cmd: `apisix version`): 2.5
   * OS (cmd: `uname -a`): Ubuntu 18.04
   * OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`): 1.19.3.1
   * etcd version, if have (cmd: run `curl http://127.0.0.1:9090/v1/server_info` to get the info from server-info API):
   * apisix-dashboard version, if have:
   * luarocks version, if the issue is about installation (cmd: `luarocks --version`):
   


-- 
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



[GitHub] [apisix] gxthrj closed issue #4197: request help: set different Host header for different Nodes in a single Upstream?

Posted by GitBox <gi...@apache.org>.
gxthrj closed issue #4197:
URL: https://github.com/apache/apisix/issues/4197


   


-- 
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



[GitHub] [apisix] tokers commented on issue #4197: request help: set different Host header for different Nodes in a single Upstream?

Posted by GitBox <gi...@apache.org>.
tokers commented on issue #4197:
URL: https://github.com/apache/apisix/issues/4197#issuecomment-834244801


   https://github.com/apache/apisix/blob/master/apisix/schema_def.lua#L392
   
   try to set `pass_host` to node.


-- 
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



[GitHub] [apisix] Gary-Airwallex commented on issue #4197: request help: set different Host header for different Nodes in a single Upstream?

Posted by GitBox <gi...@apache.org>.
Gary-Airwallex commented on issue #4197:
URL: https://github.com/apache/apisix/issues/4197#issuecomment-834231619


   Just saw this Issue https://github.com/apache/apisix/issues/2620. It seems like balancer.recreate_request() is what's needed to achieve this?


-- 
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