Multiplex TCP only if custom domain or subdomain is configured
This commit is contained in:
parent
3e6f825a9d
commit
b7020e3f3c
@ -580,8 +580,8 @@ func (cfg *TcpProxyConf) CheckForCli() (err error) {
|
||||
}
|
||||
|
||||
func (cfg *TcpProxyConf) CheckForSvr(serverCfg ServerCommonConf) (err error) {
|
||||
if len(cfg.CustomDomains) == 0 && cfg.SubDomain == "" && serverCfg.VhostTcpPort != 0 {
|
||||
return fmt.Errorf("type [tcp] not support when vhost_http_port is on but no custom domain or subdomain configured")
|
||||
if (len(cfg.CustomDomains) > 0 || cfg.SubDomain != "") && serverCfg.VhostTcpPort == 0 {
|
||||
return fmt.Errorf("custom domain or subdomain can't be configured on type [tcp] without vhost_http_port")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ func (pxy *TcpProxy) Run() (remoteAddr string, err error) {
|
||||
pxy.listeners = append(pxy.listeners, l)
|
||||
xl.Info("tcp proxy listen port [%d] in group [%s]", pxy.cfg.RemotePort, pxy.cfg.Group)
|
||||
} else {
|
||||
if pxy.serverCfg.VhostTcpPort > 0 {
|
||||
if pxy.serverCfg.VhostTcpPort > 0 && (len(pxy.cfg.CustomDomains) > 0 || pxy.cfg.SubDomain != "") {
|
||||
pxy.realPort = pxy.serverCfg.VhostTcpPort
|
||||
routeConfig := &vhost.VhostRouteConfig{}
|
||||
for _, domain := range pxy.cfg.CustomDomains {
|
||||
|
Loading…
Reference in New Issue
Block a user