What is the difference between public and private HTTPS connections?

Viewed 37

I have a Net 5 Blazor server app published on a productive server and used a valid certificate for https requests, which works fine. Newly I added a HubConnection class to support SignalR notifications between web pages. But if I call the web page through an public URL like https://crm.example.com/call, I get the following error, although the same page works fine if I call it through an internal URL like https://10.12.0.151/call:

Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host..

I don't know why it happens, what is the difference between a public and private HTTPS connection? For public connection it uses a valid public certificate and actually works fine if I deactivate the SignalR notification.

Because of the application working just fine if I call the page with an internal URL, seems that all prerequisite for using SignalR are included such as installing WebSocket-Protocol feature on the server and so on.

The following snipet shows the part of code:

     try
{
    string sHubUrl = NavManager.BaseUri;
    sHubUrl = sHubUrl.TrimEnd('/') + "/call";

    LogBuilder.LogInfo($"URL in Call.NotificationInit: " + sHubUrl);

    hubConnection = new HubConnectionBuilder()
    .WithUrl(sHubUrl, options => {
        options.UseDefaultCredentials = true;
        options.HttpMessageHandlerFactory = (msg) =>
        {
            if (msg is HttpClientHandler clientHandler)
            {
                System.Net.ServicePointManager.SecurityProtocol |= System.Net.SecurityProtocolType.Tls11 | System.Net.SecurityProtocolType.Tls12;
                // bypass SSL certificate
                clientHandler.ServerCertificateCustomValidationCallback +=
                (sender, certificate, chain, sslPolicyErrors) => { return true; };
            }

            return msg;
        };
    })
    .WithAutomaticReconnect()
    .Build();
    hubConnection.On<string, string>("NewMessage", ReceivedNotification);

    await hubConnection.StartAsync();
}
catch (Exception ex)
{
    LogBuilder.LogExecption("Exception at Call.NotificationInit");
}

What else should I do? Can anyone help me to solve this problem?

0 Answers
Related