New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(upstream) add host_header to upstream entities #4959
Conversation
Question: Will active HTTP health-check set the host header to this new property (if present) as well? |
66774d9
to
5fbf7d6
Compare
No, it won't. I will change this behavior, thanks for pointing that, @hbagdi! |
This change doesn't make sense to me. afaik we have 2 possible values for the upstream host-header; the incoming host-header, or the hostname of the upstream server. This subject is complicated because we do not cleanly separate teh construction of the upstream request in our flow. As mentioned elsewhere; we need to collect info in Adding this extra property only makes thing more complicated imo. In pseudo code: -- pre-access
host_header_incoming = request.headers["Host"]
host_header_upstream = nil
host_header_preserve = route.preserve_hostname
-- pdk
function set_upstream_host_header(name)
host_header_upstream = name
end
function set_host_preserve(bool)
host_header_preserve = bool
end
--post-access
ip, port, resolved_name = dns.resolve() -- includes balancers, returns hostname resolved, or target name if balancer
host_header_upstream = host_header_upstream or
(host_header_preserve and host_header_incoming) or
resolved_name Does this make sense? |
0cff500
to
819b1a0
Compare
af43908
to
9200e81
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, getting there! Left a couple of suggestions.
-- configure healthchecks | ||
begin_testcase_setup(strategy, bp) | ||
local upstream_name, upstream_id = add_upstream(bp, { | ||
hostname = "localhost", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make this a value other than localhost
, some invalid name like upstream-hostname.test
to make sure this test does not use the underlying system's name resolution in any way?
ced94ad
to
d67109b
Compare
d67109b
to
f85cc59
Compare
This attribute is used as the Host header when proxying requests through Kong. It takes precedence over the Host that clients send to Kong.
This attribute is used as the Host header when proxying requests through Kong. It takes precedence over the Host that clients send to Kong.
Add support to hostname attribute in upstream entities.
This attribute is used as the
Host
header when proxying requests through Kong. It takes precedence over theHost
that clients send to Kong.