mirror of
https://github.com/gravitational/teleport.git
synced 2026-09-01 16:03:55 +08:00
3c77541d06
i.Web is also used as tconf.Proxy.WebAddr.Addr a couple of lines below. When pinging the proxy, TeleportClient takes the response and updates a couple of values based on that response. If proxySettings.SSH.PublicAddr is not empty, it tries to parse the address and then set it as tc.WebProxyAddr. [1] If it cannot parse the port number, it uses the default (3080). What is getting returned as `proxySettings.SSH.PublicAddr`? That's determined by setProxyPublicAddressesSettings in lib/service/proxy_settings.go. [2] It uses the first element from Proxy.PublicAddrs. Now, the integration test helpers set up the Teleport instance in such way that the first Proxy.PublicAddrs is set to i.Hostname which resolves to just "localhost" in tests. So if any test pings the proxy first and then tries to make another request with the same TeleportClient, the subsequent request will try to reach out to localhost:3080. This happened to me when trying to add a new test. [3] This PR fixes this by making sure that the first element of Proxy.PublicAddrs actually points at the address of the web UI. See also the message from Marek about backwards compatibility of SSHProxyHostPort. [4] [5] [1] https://github.com/gravitational/teleport/blob/885d7397ab3746154342712bec86bcdb3ea93eab/lib/client/api.go#L3666-L3673 [2] https://github.com/gravitational/teleport/blob/806a568ada7c640a64eb60f718e7d56be34049ad/lib/service/proxy_settings.go#L112 [3] https://github.com/gravitational/teleport/pull/20263 [4] https://gravitational.slack.com/archives/C0DF0TPMY/p1673895327794379?thread_ts=1673891288.249809&cid=C0DF0TPMY [5] https://github.com/gravitational/teleport/blob/db7fdff8097bcc883af8d9dde6a271d07e418550/api/client/webclient/webclient.go#L490