在javascript中检测SNI(服务器名称指示)浏览器支持 [英] Detecting SNI (Server Name Indication) browser support in javascript

查看:309
本文介绍了在javascript中检测SNI(服务器名称指示)浏览器支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够检测浏览器是否支持 SNI - 服务器名称指示。我希望将不合规的客户端重定向到不同的地址。

I want to be able to detect if the browser support SNI - Server Name Indication. I'm hoping to redirect non compliant clients to a different address.

我正在考虑通过SSL加载一些内容并确保它被安全地转移。否则浏览器不支持SNI。可以这样做吗?

I was thinking of loading some content through SSL and make sure it was transfered securely. Otherwise the browser doesn't support SNI. Can this be done?

推荐答案

你可以设置一个支持SNI的服务器,提供两个主机名,你需要SNI的地方和一个后备的服务器解决方案,都提供他们正在托管的名称。

You could set up a server that supports SNI, serving two host names, on where you require SNI and one that's a fallback solution, both serving the name that they are hosting.

以下内容:


  • https://www.example.com/name 返回一个表示我是www.example.com

  • https://www.example.net/name 返回我是www。 example.net (并要求SNI)。

  • https://www.example.com/name returns a representation saying I'm www.example.com
  • https://www.example.net/name returns I'm www.example.net (and requires SNI).

如果您向<$ c $发出XHR请求c> https://www.example.net/name 并返回 www.example.com ,然后浏览器不支持SNI 。

If you make an XHR request to https://www.example.net/name and it returns www.example.com, then the browser doesn't support SNI.

这篇关于在javascript中检测SNI(服务器名称指示)浏览器支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆