Repository navigation
Conversation
Contributor
Author
…proxy client ip header
Chaho12
force-pushed
the
kyuubi-7807-trino-client-ip-header
branch
from
November 28, 2026 14:17
60b657d to
fd2b64e
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why are the changes needed?
The thrift HTTP and REST frontends take the client address of a session from the header named by
kyuubi.frontend.proxy.http.client.ip.headerand fall back to the TCP peer. The Trino frontendalways uses
httpRequest.getRemoteAddr, so behind a load balancer or gateway every Trino sessiongets the proxy's address.
kyuubi.server.limit.connections.per.ipaddressthen counts all Trinoclients against one address,
kyuubi.server.limit.connections.ip.deny.listcannot single out aclient, and the session's
clientIpshows the proxy.This patch adds
clientIpAddressto the TrinoApiRequestContext- the configured header ifpresent, otherwise the TCP peer - and uses it in the five places of
StatementResourcethat builda
TrinoContext. The Trino frontend has noAuthenticationFilter, which is where the other HTTPfrontends read the header, so it reads the header itself.
One difference from REST: a blank header falls back to the TCP peer instead of becoming an empty
address, since the limiter and the ip deny list skip a blank address. As with the other frontends,
the header is trusted only as far as the proxy in front of the server.
Affects master and 1.11.1.
close #7807
How was this patch tested?
Added three cases to
StatementResourceSuite, each submittingselect 1and checking the IPaddress of the session it opens: with
X-Real-IP: 10.1.2.3it is10.1.2.3; without the header,and with a blank one, it is the TCP peer.
All 7 pass with the change. With
StatementResourcereverted togetRemoteAddr, the header casefails with
"127.0.0.1" did not equal "10.1.2.3"; without the blank-header fallback, the blankcase fails with
"" was empty.The suite launches a Spark engine, so
externals/kyuubi-spark-sql-enginehas to be packaged first.Was this patch assisted by generative AI tooling?
Assisted-by: Claude Opus 5.5