Detecting SNI (Server Name Indication) browser support in javascript(在 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
返回表示I'm www.example.com
https://www.example.net/name
返回I'm www.example.net
(并且需要 SNI).
https://www.example.com/name
returns a representation sayingI'm www.example.com
https://www.example.net/name
returnsI'm www.example.net
(and requires SNI).
如果您向 https://www.example.net/name
发出 XHR 请求并返回 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(服务器名称指示)浏览器支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 javascript 中检测 SNI(服务器名称指示)浏览器支持


- 是否可以将标志传递给 Gulp 以使其以不同的方式 2022-01-01
- 从原点悬停时触发 translateY() 2022-01-01
- 为什么我的页面无法在 Github 上加载? 2022-01-01
- 使用 iframe URL 的 jQuery UI 对话框 2022-01-01
- 在不使用循环的情况下查找数字数组中的一项 2022-01-01
- 如何调试 CSS/Javascript 悬停问题 2022-01-01
- 我不能使用 json 使用 react 向我的 web api 发出 Post 请求 2022-01-01
- 为什么悬停在委托事件处理程序中不起作用? 2022-01-01
- 如何显示带有换行符的文本标签? 2022-01-01
- 如何向 ipc 渲染器发送添加回调 2022-01-01