-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Add client option to disable following redirects #21027
base: master
Are you sure you want to change the base?
Conversation
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: alprusty.
|
1 similar comment
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: alprusty.
|
f9932c7
to
7b2a197
Compare
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: alprusty.
|
We shouldn't make this change until we've a clear consensus on whether to include the Authorization header on redirects. |
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: alprusty.
|
Also fyi @sajjoseph |
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: alprusty.
|
@@ -273,6 +273,9 @@ public class ClientOptions | |||
@Option(names = "--disable-auto-suggestion", description = "Disable auto suggestion") | |||
public boolean disableAutoSuggestion; | |||
|
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.
Introduced a new client option to disable redirects.
client/trino-client/src/main/java/io/trino/client/OkHttpUtil.java
Outdated
Show resolved
Hide resolved
CLA is signed .. I am working with @alprusty to get configuration fixed |
@cla-bot check |
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: alprusty.
|
The cla-bot has been summoned, and re-checked this pull request! |
fbdd26a
to
4768a5d
Compare
client/trino-client/src/main/java/io/trino/client/OkHttpUtil.java
Outdated
Show resolved
Hide resolved
@alprusty We also need a regression test on the client actually sent the Authorization header after a redirect. |
1dcc9a5
to
4dffa6b
Compare
@oneonestar
Please review again 🙏 |
It will be great if this PR can be split into two.
|
fab4b2c
to
854b91e
Compare
client/trino-cli/src/test/java/io/trino/cli/TestClientOptions.java
Outdated
Show resolved
Hide resolved
client/trino-jdbc/src/test/java/io/trino/jdbc/TestTrinoDriverUri.java
Outdated
Show resolved
Hide resolved
client/trino-cli/src/test/java/io/trino/cli/TestClientRedirect.java
Outdated
Show resolved
Hide resolved
client/trino-cli/src/test/java/io/trino/cli/TestClientRedirect.java
Outdated
Show resolved
Hide resolved
client/trino-cli/src/test/java/io/trino/cli/TestClientRedirect.java
Outdated
Show resolved
Hide resolved
client/trino-client/src/main/java/io/trino/client/JsonResponse.java
Outdated
Show resolved
Hide resolved
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.
client/trino-cli/src/test/java/io/trino/cli/TestClientRedirect.java
Outdated
Show resolved
Hide resolved
client/trino-cli/src/test/java/io/trino/cli/TestClientRedirect.java
Outdated
Show resolved
Hide resolved
docs/src/main/sphinx/client/cli.md
Outdated
@@ -149,6 +149,8 @@ mode: | |||
processing statistics. | |||
* - `--disable-auto-suggestion` | |||
- Disables autocomplete suggestions. | |||
* - `--disable-follow-redirects` | |||
- If set to `true`, then disables client redirects. Default is `false`. |
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.
@mosabua Any comments for the docs?
ed706bd
to
c991e9b
Compare
squashed all commits as one |
c991e9b
to
f27709f
Compare
This pull request has gone a while without any activity. Tagging the Trino developer relations team: @bitsondatadev @colebow @mosabua |
f27709f
to
d28cb16
Compare
d28cb16
to
f413537
Compare
Description
During 412 release as part of OkHttp version upgrade, explicit client retry logic was removed in the event of a 307/308 redirect. This will cause 401: 'Unauthorized' error when trino client is talking to a Trino Cluster that is deployed behind a load balancer(For example AWS ALB) with a redirect mode(e.g. 307/308) routing policy.
Reference: 4be1401
Okhttp by default does follow redirects. However it drops Authorization headers if the redirect is across hosts.
Reference: https://github.com/square/okhttp/blob/okhttp_4.10.x/okhttp/src/main/kotlin/okhttp3/internal/http/RetryAndFollowUpInterceptor.kt#L323-L328
Solution:
This PR introduces a flag
--disable-follow-redirects
to give an option to clients to follow a redirect or not. By default the flag is set tofalse
which means redirects are going to be followed.Additional context and related issues
Fixes #21026
Release notes
( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text: