Andres Olarte Andres Olarte - 1 year ago 75
Javascript Question

Detecting SNI (Server Name Indication) browser support in javascript

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 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?

Answer Source

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.