From a56f068f8c008ddf6a4038ef188313e0b5d10a19 Mon Sep 17 00:00:00 2001 From: fatedier Date: Sun, 25 Dec 2016 14:15:34 +0800 Subject: [PATCH] subdomain: fix a bug that subdomain is not correct for https, close #194 --- src/models/client/config.go | 3 +++ src/models/server/server.go | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/src/models/client/config.go b/src/models/client/config.go index ff933fa..03eabde 100644 --- a/src/models/client/config.go +++ b/src/models/client/config.go @@ -166,6 +166,9 @@ func LoadConf(confFile string) (err error) { if ok { proxyClient.HttpPassWord = tmpStr } + + } + if proxyClient.Type == "http" || proxyClient.Type == "https" { // subdomain tmpStr, ok = section["subdomain"] if ok { diff --git a/src/models/server/server.go b/src/models/server/server.go index 37eacc7..8167f51 100644 --- a/src/models/server/server.go +++ b/src/models/server/server.go @@ -184,6 +184,13 @@ func (p *ProxyServer) Start(c *conn.Conn) (err error) { } p.listeners = append(p.listeners, l) } + if p.SubDomain != "" { + l, err := VhostHttpsMuxer.Listen(p.SubDomain, "", p.HostHeaderRewrite, p.HttpUserName, p.HttpPassWord) + if err != nil { + return err + } + p.listeners = append(p.listeners, l) + } } p.Lock()