From ad1e32fd2dcae0bdf1dade5975e719791bd07f11 Mon Sep 17 00:00:00 2001 From: fatedier Date: Fri, 18 May 2018 00:21:11 +0800 Subject: [PATCH] fix panic error when vhost_http_port is not set but there is a http proxy, fix #776 --- models/config/proxy.go | 2 +- utils/vhost/newhttp.go | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/models/config/proxy.go b/models/config/proxy.go index 8b6c0821..65644fab 100644 --- a/models/config/proxy.go +++ b/models/config/proxy.go @@ -509,7 +509,7 @@ func (cfg *HttpProxyConf) CheckForCli() (err error) { func (cfg *HttpProxyConf) CheckForSvr() (err error) { if vhostHttpPort == 0 { - err = fmt.Errorf("type [http] not support when vhost_http_port is not set") + return fmt.Errorf("type [http] not support when vhost_http_port is not set") } if err = cfg.DomainConf.checkForSvr(); err != nil { err = fmt.Errorf("proxy [%s] domain conf check error: %v", cfg.ProxyName, err) diff --git a/utils/vhost/newhttp.go b/utils/vhost/newhttp.go index 859e6720..819ce1d1 100644 --- a/utils/vhost/newhttp.go +++ b/utils/vhost/newhttp.go @@ -49,7 +49,6 @@ func getHostFromAddr(addr string) (host string) { type HttpReverseProxy struct { proxy *ReverseProxy - tr *http.Transport vhostRouter *VhostRouters