change the Host value in http request header

This commit is contained in:
Maodanping
2016-07-24 15:00:18 +08:00
parent 4067591a4d
commit e0f2993b70
7 changed files with 165 additions and 9 deletions

View File

@@ -22,4 +22,7 @@ type BaseConf struct {
UseGzip bool
PrivilegeMode bool
PrivilegeToken string
ClientIp string
ClientPort int64
ServerPort int64
}

View File

@@ -26,6 +26,8 @@ type ControlReq struct {
AuthKey string `json:"auth_key"`
UseEncryption bool `json:"use_encryption"`
UseGzip bool `json:"use_gzip"`
LocalIp string `json:"local_ip"`
LocalPort int64 `json:"local_port"`
// configures used if privilege_mode is enabled
PrivilegeMode bool `json:"privilege_mode"`

View File

@@ -64,6 +64,7 @@ func NewProxyServerFromCtlMsg(req *msg.ControlReq) (p *ProxyServer) {
p.BindAddr = BindAddr
p.ListenPort = req.RemotePort
p.CustomDomains = req.CustomDomains
p.ServerPort = VhostHttpPort
return
}
@@ -113,7 +114,7 @@ func (p *ProxyServer) Start(c *conn.Conn) (err error) {
p.listeners = append(p.listeners, l)
} else if p.Type == "http" {
for _, domain := range p.CustomDomains {
l, err := VhostHttpMuxer.Listen(domain)
l, err := VhostHttpMuxer.Listen(domain, p.Type, p.ClientIp, p.ClientPort, p.ServerPort)
if err != nil {
return err
}
@@ -121,7 +122,7 @@ func (p *ProxyServer) Start(c *conn.Conn) (err error) {
}
} else if p.Type == "https" {
for _, domain := range p.CustomDomains {
l, err := VhostHttpsMuxer.Listen(domain)
l, err := VhostHttpsMuxer.Listen(domain, p.Type, p.ClientIp, p.ClientPort, p.ServerPort)
if err != nil {
return err
}