support the configure of url in "http" section

This commit is contained in:
XueBing
2016-12-18 22:40:58 +08:00
parent 47db75e921
commit edf4bc431d
10 changed files with 227 additions and 106 deletions

View File

@@ -296,6 +296,12 @@ func loadProxyConf(confFile string) (proxyServers map[string]*ProxyServer, err e
} else {
return proxyServers, fmt.Errorf("Parse conf error: proxy [%s] custom_domains must be set when type equals http", proxyServer.Name)
}
//location
locStr, loc_ok := section["custom_location"]
if loc_ok {
proxyServer.Locations = strings.Split(locStr, ",")
}
} else if proxyServer.Type == "https" {
// for https
proxyServer.ListenPort = VhostHttpsPort
@@ -318,9 +324,8 @@ func loadProxyConf(confFile string) (proxyServers map[string]*ProxyServer, err e
}
// set metric statistics of all proxies
for name, p := range proxyServers {
metric.SetProxyInfo(name, p.Type, p.BindAddr, p.UseEncryption, p.UseGzip,
p.PrivilegeMode, p.CustomDomains, p.ListenPort)
for _, p := range proxyServers {
metric.SetProxyInfo(*p.ProxyServerConf)
}
return proxyServers, nil
}
@@ -381,8 +386,7 @@ func CreateProxy(s *ProxyServer) error {
}
}
ProxyServers[s.Name] = s
metric.SetProxyInfo(s.Name, s.Type, s.BindAddr, s.UseEncryption, s.UseGzip,
s.PrivilegeMode, s.CustomDomains, s.ListenPort)
metric.SetProxyInfo(*s.ProxyServerConf)
s.Init()
return nil
}