Browse Source

subdomain: fix a bug that subdomain is not correct for https, close #194

fatedier 8 years ago
parent
commit
a56f068f8c
2 changed files with 10 additions and 0 deletions
  1. 3 0
      src/models/client/config.go
  2. 7 0
      src/models/server/server.go

+ 3 - 0
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 {

+ 7 - 0
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()