How do I ListenAndServeTLS with multiple domains? I see the function accepts a cert and key file, but I believe the key file may only contain a single private key. I have a few private keys, for different certificate chains.
相关问题
- Mechanize getting “Errno::ECONNRESET: Connection r
- Golang mongodb aggregation
- Can ServiceStack JsonServiceClient send a get requ
- Tomcat and SSL Client certificate
- How to flatten out a nested json structure in go
相关文章
- 请大神帮忙 post向https接口发送数据 部署到服务器为什么运行一会后就会报空指针
- ssl配置问题
- Can I run a single test in a suite?
- Intermittent “sslv3 alert handshake failure” under
- How to check if a request was cancelled
- Is it possible to implement an interface with unex
- How to access value of first index of array in Go
- Making a two way SSL authentication between apache
http.ListenAndServeTLS
is meant to be present a bare minimal configuration. If you want to add other options, you can create anhttp.Server
with a customtls.Config
. You can then either manually map names intls.Config.NameToCertificate
, or callBuildNameToCertificate()
to build the map programatically.You can still use
Server.ListenAndServeTLS
however, since it will load the certs in the config as well a cert passed in via the methods args.I'm no Go user myself but if you want to use multiple certificates on the same TLS listener you must have some way to decide which certificate should be used once a client connects because only a single certificate + chain can be sent inside the TLS handshake.
The main use case for this is Server Name Indication (SNI). With SNI you have multiple certificates and you want to select the appropriate one based on the name the client asked for within the TLS handshake.
Searching for go sni server results in this post from 2013. This post shows that using multiple certificates with ListenAndServeTLS is not possible (or was in 2013) but it also shows how to achieve the necessary functionality.