-
Notifications
You must be signed in to change notification settings - Fork 10k
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
SignalR core client is not connecting to SignalR core hub over Https #14102
Comments
SSL should work fine. Could you show the logs from server and client, preferably at the debug level? |
You do need to configure the SignalR client to accept untrusted SSL certificates. Have you done this? You need to change the WebSocket configuration and HttpClient configuration to accept your custom certificate by adding a custom certificate validate callback. Right now that's not trivial (we should improve this, I filed #14427). You can use the _connection = new HubConnectionBuilder()
.WithUrl(_hubRoot, options =>
{
// Register the custom handler above and also configure WebSockets
options.HttpMessageHandlerFactory = handler =>
{
if (handler is HttpClientHandler clientHandler)
{
clientHandler.ServerCertificateCustomValidationCallback = (httpRequestMessage, cert, cetChain, policyErrors) =>
{
// Validate the cert here and return true if it's correct.
// If this is a development app, you could just return true always
// In production you should ALWAYS either use a trusted cert or check the thumbprint of the cert matches one you expect.
}
}
return handler;
};
options.WebSocketConfiguration = sockets =>
{
sockets.RemoteCertificateValidationCallback = (sender, certificate, chain, policyErrors) =>
{
// You have to repeat your cert validation code here. Feel free to use a helper method!
});
};
})
.Build(); Let us know if that resolves the issue. If not, we can investigate further. |
Closing this as we haven't heard from you and generally close issues with no response after some time. Please feel free to comment if you're able to get the information we're looking for and we can reopen the issue to investigate further! |
Hello I have the same issue and tried to implement the suggested fix this is the error I get. 'ClientWebSocketOptions' does not contain a definition for 'RemoteCertificateValidationCallback' and no accessible extension method 'RemoteCertificateValidationCallback' accepting a first argument of type 'ClientWebSocketOptions' could be found (are you missing a using directive or an assembly reference?) |
The |
I have created SignalR hub in asp.net core and deployed it on linux. I am using nginx as a reverse proxy server that is redirecting my request to dotnet core application that is hosted on Kestrel.
My SignalR clients are windows form applications. SignalR hub url is "/myhub". When my SignalR client access the hub on Http(http://myIPhere/myhub), it gets connected with hub, but when my client access https url(https://myIPhere/myhub) then it is not connecting.
Is there any issue of SSL? As I donot have Trusted certificate for my web Application (on which SignalR Hub is created) I have created local test certificate for my web application.
After watching outgoing requests in Fiddler i am getting "error:handshake was canceled" from the hub.
Following is my nginx configuration
The text was updated successfully, but these errors were encountered: