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

Authentication failed because the connection could not be reused #70

Open
dsivori1 opened this issue Nov 5, 2020 · 5 comments
Open

Comments

@dsivori1
Copy link

dsivori1 commented Nov 5, 2020

Trying to set up a proxy to a Rest Service that used NTLM Authentication. I don't know that you can resolve it, but I'm getting this error:

Authentication failed because the connection could not be reused.

at System.Net.Http.HttpConnection.DrainResponseAsync(HttpResponseMessage response)
at System.Net.Http.AuthenticationHelper.SendWithNtAuthAsync(HttpRequestMessage request, Uri authUri, ICredentials credentials, Boolean isProxyAuth, HttpConnection connection, HttpConnectionPool connectionPool, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithNtConnectionAuthAsync(HttpConnection connection, HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.AuthenticationHelper.SendWithAuthAsync(HttpRequestMessage request, Uri authUri, ICredentials credentials, Boolean preAuthenticate, Boolean isProxyAuth, Boolean doRequestAuth, HttpConnectionPool pool, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.DiagnosticsHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at Microsoft.Extensions.Http.Logging.LoggingScopeHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at AspNetCore.Proxy.HttpExtensions.ExecuteHttpProxyOperationAsync(HttpContext context, HttpProxy httpProxy)
SsrsController.cs.txt
Startup.cs.txt

@twitchax
Copy link
Owner

twitchax commented Nov 5, 2020

Interesting. I will probably need to write a test to repro this, and then debug. If you could write a test, that would help, as well.

Preliminarily, it sounds a bit like #70.

@Eweol
Copy link

Eweol commented Jan 24, 2023

I have the same issue now.

I figured out some more informations which could maybe help to fix that.
This error only appears if the client and server uses HTTPv2 as protocol.
With HTTPv1.1 everything is working like expected.

@Eweol
Copy link

Eweol commented Feb 7, 2023

Figured out, it can be solved with solution of #91.

Can be closed

@twitchax
Copy link
Owner

twitchax commented Feb 7, 2023

Interesting. Maybe I should add a section about SSRS to the README.

Would you mind helping me out with it since I would yield to your expertise about why this happens.

@Eweol
Copy link

Eweol commented Feb 7, 2023

I don't think that it is only related to SSRS (even if I had the problem as well with SSRS), but it seems like the following.
If you setup a request with HTTP v1 / HTTP v1.1 than everything is quiet fine without any issue because you have set default wise the header "Connection" to "keep-alive".
If you now setup same call with HTTP v2 / HTTP v3 this header is not attached because it is not allowed and not needed within these protocols.
The proxy now copies all the headers from that request but not the "Connection" header because it is not there.
related to that the NTLM authentication cannot be fulfilled because the connection will be interrupted.

I don't know if that problem can also be solved by recognising the HTTP protocol version and use same than the initial one.

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

No branches or pull requests

3 participants