Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d1b7f80

Browse files
committed
fix: remove port from TLS server name validation (#28)
1 parent 3292f1f commit d1b7f80

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

derp/derphttp/derphttp_client.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,9 @@ func (c *Client) useHTTPS(node *tailcfg.DERPNode) bool {
198198
// tlsServerName returns the tls.Config.ServerName value (for the TLS ClientHello).
199199
func (c *Client) tlsServerName(node *tailcfg.DERPNode) string {
200200
if c.url != nil {
201-
return c.url.Host
201+
// Host contains port which breaks cert validation. Hostname() strips
202+
// the port.
203+
return c.url.Hostname()
202204
}
203205
if node == nil {
204206
return ""

0 commit comments

Comments
 (0)