Skip to content
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

Unexpected Behavior: httpHeaders Callback Invoked for Every Request Instead of Only During Initial CONNECT in Netty HTTP Client with Proxy #3501

Open
matthew-js-porter opened this issue Nov 6, 2024 · 1 comment · May be fixed by #3517
Assignees
Labels
type/bug A general bug
Milestone

Comments

@matthew-js-porter
Copy link

When configuring a Netty HTTP client to use a proxy, I would have expected the headers callback specified in the ProxyProvider to be called only during the initial CONNECT request to the proxy server and that after the tunnel was created there would be no need to call the headers callback. Is my understanding on the proxy correct or am I completely off base here?

Expected Behavior

The httpHeaders method to be called only when creating the tunnel to the Proxy.

Actual Behavior

The httpHeaders method is ran for every request the httpClient makes.

Steps to Reproduce

Configure HTTP Client with a Proxy like this. When making requests observe that the httpHeaders method is ran for each request.

final var httpClient = HttpClient.create().proxy(proxy -> proxy.type(ProxyProvider.Proxy.HTTP).host(proxyUrl).port(proxyPort).httpHeaders(headers -> {
            System.out.println("in headers");
           //headers.add("Proxy-Authorization", "Negotiate " + getKerberosToken());
        }).build());
  • Reactor version(s) used: Reactor Netty 1.1.22
@matthew-js-porter matthew-js-porter added status/need-triage A new issue that still need to be evaluated as a whole type/bug A general bug labels Nov 6, 2024
@violetagg violetagg self-assigned this Nov 8, 2024
@violetagg violetagg removed the status/need-triage A new issue that still need to be evaluated as a whole label Nov 8, 2024
@violetagg violetagg added this to the 1.1.25 milestone Nov 25, 2024
violetagg added a commit that referenced this issue Nov 26, 2024
Configurations like address, headers, password are calculated just before sending the request.
If a configuration is changed a new connection pool will be created.

Fixes #3501
@violetagg violetagg linked a pull request Nov 26, 2024 that will close this issue
@violetagg violetagg linked a pull request Nov 26, 2024 that will close this issue
@violetagg
Copy link
Member

violetagg commented Nov 26, 2024

@matthew-js-porter The behaviour is intentional - if the token is changed then we need to discard the old pooled connections and start new connections with the new token.

I prepared a PR #3517 that will guarantee that we will invoke this just once though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug A general bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants