Detecting SNI (Server Name Indication) browser support in javascript

后端 未结 4 1175
野的像风
野的像风 2021-01-02 02:13

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.

I was thinkin

4条回答
  •  执念已碎
    2021-01-02 02:28

    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.

    Something along the lines of:

    • 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).

    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.

提交回复
热议问题