[ADD] Add entrance plugin HTTPS support and certificate configuration

This commit is contained in:
pujielan 2018-01-08 14:50:17 +08:00
parent 11c9eee3be
commit 5537611b59

View File

@ -462,14 +462,14 @@ func (n *nginxAPI) addDomain(ads *AddDomainS) bool {
if !bytes.HasPrefix([]byte(ads.Domain), []byte(fmt.Sprintf("%s.%s", p.Port, p.Servicename))) {
if ads.HTTPS && ads.CertificateName != "" {
httpsInfo := bytes.NewBuffer(nil)
httpsInfo.WriteString(`https=true`)
httpsInfo.WriteString(`https=https`)
httpsInfo.WriteString(fmt.Sprintf(`&cert_name=%s&`, ads.CertificateName))
httpsInfo.WriteString(string(upstream))
logrus.Debugf("https info is %v", string(httpsInfo.Bytes()))
pha.UpStream = httpsInfo.Bytes()
} else if ads.TransferHTTP && ads.CertificateName != "" {
httpsInfo := bytes.NewBuffer(nil)
httpsInfo.WriteString(`tran_https=true`)
httpsInfo.WriteString(`https=tran_https`)
httpsInfo.WriteString(fmt.Sprintf(`&cert_name=%s&`, ads.CertificateName))
httpsInfo.WriteString(string(upstream))
logrus.Debugf("trans https info is %v", string(httpsInfo.Bytes()))