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(服务器名称指示)浏览器支持


基础教程推荐
- 在 JS 中获取客户端时区(不是 GMT 偏移量) 2022-01-01
- 在for循环中使用setTimeout 2022-01-01
- 动态更新多个选择框 2022-01-01
- 有没有办法使用OpenLayers更改OpenStreetMap中某些要素 2022-09-06
- 悬停时滑动输入并停留几秒钟 2022-01-01
- Karma-Jasmine:如何正确监视 Modal? 2022-01-01
- 响应更改 div 大小保持纵横比 2022-01-01
- 当用户滚动离开时如何暂停 youtube 嵌入 2022-01-01
- 我什么时候应该在导入时使用方括号 2022-01-01
- 角度Apollo设置WatchQuery结果为可用变量 2022-01-01