[英]Ignore Self-Signed certificate when building Url for SignalR javascript client
Is there a way to bypass a self-signed certificate when building the Url on signalR.HubConnectionBuilder() of JavaScript client?在 JavaScript 客户端的 signalR.HubConnectionBuilder() 上构建 Url 时,有没有办法绕过自签名证书?
I found this can be done and work perfectly in C# client with the following code我发现这可以使用以下代码在 C# 客户端中完成并完美运行
connection = new HubConnectionBuilder()
.WithUrl("https://localhost:443/hub", (opts) =>
{
opts.HttpMessageHandlerFactory = (message) =>
{
if (message is HttpClientHandler clientHandler)
// bypass SSL certificate
clientHandler.ServerCertificateCustomValidationCallback +=
(sender, certificate, chain, sslPolicyErrors) => { return true; };
return message;
};
})
.Build();
But, I'm searching for exactly that in JavaScript client.但是,我正在 JavaScript 客户端中搜索。
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0; // Disabling certificate verification
Adding the above line before attempting to make the connection solved it for me in NodeJS.在尝试建立连接之前添加上面的行在 NodeJS 中为我解决了这个问题。 This is for my developer setup.这是我的开发人员设置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.