I think we can make the `upstream.node` and `upstream.type` optional.
We can support those three ways:

```1
{
    "upstream_host": "httpbin.org"  # send request to `httpbin.org` with
same host name
}
```

or


```2
{
    "upstream_host": "httpbin.org",
    "type":"roundrobin",
    "nodes": {"foo.com:80": 100},  # send request to `foo.com` with host
name `httpbin.org`
}
```

or

```3
{
    "type":"roundrobin",
    "nodes": {"foo.com:80": 100},  # send request to `foo.com` with current
request host
}
```

What do you think?


On Thu, Mar 18, 2021 at 1:07 PM Zhiyuan Ju <juzhiy...@apache.org> wrote:

> And we need a plan to do some changes on APISIX IMO, anyone would like to
> take this issue?
>
> Zhiyuan Ju <juzhiy...@apache.org>于2021年3月18日 周四下午1:06写道:
>
> > Yep
> >
> > Chao Zhang <zchao1...@gmail.com>于2021年3月18日 周四下午1:04写道:
> >
> >> I think the point that put forward by Ju is same with what I proposed :)
> >>
> >> Chao Zhang
> >> https://github.com/tokers
> >>
> >> On March 18, 2021 at 11:55:14 AM, Ming Wen (wenm...@apache.org) wrote:
> >>
> >> chao zhang's idea is good for me.
> >> what do you think?
> >>
> >> Thanks,
> >> Ming Wen, Apache APISIX PMC Chair
> >> Twitter: _WenMing
> >>
> >>
> >> Zhiyuan Ju <juzhiy...@apache.org> 于2021年3月18日周四 上午11:49写道:
> >>
> >> > Any conclusion and plan here?
> >> >
> >> > There has 1 related PR[1].
> >> >
> >> > [1] https://github.com/apache/apisix-dashboard/pull/1603
> >> >
> >> > Best Regards!
> >> > @ Zhiyuan Ju <https://github.com/juzhiyuan>
> >> >
> >> >
> >> > Zhiyuan Ju <juzhiy...@apache.org> 于2021年3月17日周三 下午11:22写道:
> >> >
> >> > > yep, after going through Tyk & Kong, I would agree to use
> >> `preserve_host`
> >> > > to replace the current 3 opinions.
> >> > >
> >> > > Best Regards!
> >> > > @ Zhiyuan Ju <https://github.com/juzhiyuan>
> >> > >
> >> > >
> >> > > Ming Wen <wenm...@apache.org> 于2021年3月17日周三 下午5:44写道:
> >> > >
> >> > >> nice!
> >> > >> +1
> >> > >>
> >> > >> Chao Zhang <zchao1...@gmail.com>于2021年3月17日 周三下午3:12写道:
> >> > >>
> >> > >> > Why not just use one option, "Preserve Client Host”, by default
> >> it’s
> >> > >> > closed, which means the Host header will be rewrite to the
> Upstream
> >> > >> host;
> >> > >> > When it’s opened, the client host will inherited
> >> > >> > when proxying to upstream.
> >> > >> >
> >> > >> > Chao Zhang
> >> > >> > https://github.com/tokers
> >> > >> >
> >> > >> > On March 17, 2021 at 2:49:50 PM, Ming Wen (wenm...@apache.org)
> >> wrote:
> >> > >> >
> >> > >> > I think there should be only two options: preserve and use
> upstream
> >> > >> host,
> >> > >> > the default is the latter
> >> > >> >
> >> > >> > JunXu Chen <chenju...@apache.org>于2021年3月17日 周三下午1:46写道:
> >> > >> >
> >> > >> > > Hi, Community,
> >> > >> > >
> >> > >> > > Currently we use `pass_host` to mark how to process the
> upstream
> >> > >> > request’s
> >> > >> > > Host header.
> >> > >> > >
> >> > >> > > It can be one of [`pass`, `node`, `rewrite`], the default
> option
> >> is
> >> > >> > `pass`.
> >> > >> > > pass: Pass the client's host transparently to the upstream;
> >> > >> > > node: Use the host configured in the node of upstream;
> >> > >> > > rewrite: Use the value of the configuration upstream_host.
> >> > >> > >
> >> > >> > > Referring to nginx(proxy_pass), tyk and kong, we found that
> their
> >> > >> default
> >> > >> > > behavior is not to preserve the client's request Host, but to
> set
> >> > the
> >> > >> > > upstream request’s Host header to the hostname specified in the
> >> > >> > > upstream(service) by default.
> >> > >> > >
> >> > >> > > issues:
> >> > >> > >
> >> > >> > > 1. `pass_host` is not easy to understand, I think we could use
> >> > >> > > `preserve_host` or `preserve_host_header` instead.
> >> > >> > >
> >> > >> > > 2. We should also be the same behavior as nginx, tyk and kong,
> >> not
> >> > >> > preserve
> >> > >> > > the client's request Host by default if the hostname has been
> >> > >> specified
> >> > >> > in
> >> > >> > > the upstream.
> >> > >> > >
> >> > >> > > What is your opinion? Thanks!
> >> > >> > >
> >> > >> > --
> >> > >> > Thanks,
> >> > >> > Ming Wen, Apache APISIX PMC Chair
> >> > >> > Twitter: _WenMing
> >> > >> >
> >> > >> --
> >> > >> Thanks,
> >> > >> Ming Wen, Apache APISIX PMC Chair
> >> > >> Twitter: _WenMing
> >> > >>
> >> > >
> >> >
> >>
> > --
> > 来自 琚致远
> >
> --
> 来自 琚致远
>


-- 

*MembPhis*
My GitHub: https://github.com/membphis
Apache APISIX: https://github.com/apache/apisix

Reply via email to