fix 4907: force admin service http only

This commit is contained in:
Deng Ming 2022-07-02 16:51:47 +08:00
parent 4ec8eefa42
commit bf60d037f2
2 changed files with 4 additions and 1 deletions

View File

@ -1,5 +1,6 @@
# developing
- [Fix 4984: random expire cache](https://github.com/beego/beego/pull/4984)
- [Fix 4907: make admin serve HTTP only](https://github.com/beego/beego/pull/5005)
# v2.0.4

View File

@ -16,6 +16,7 @@ package web
import (
"fmt"
"net"
"net/http"
"reflect"
"time"
@ -86,7 +87,7 @@ func (admin *adminApp) Run() {
" please invoke task.StartTask, or task will not be executed")
addr := BConfig.Listen.AdminAddr
if BConfig.Listen.AdminPort != 0 {
addr = fmt.Sprintf("%s:%d", BConfig.Listen.AdminAddr, BConfig.Listen.AdminPort)
addr = net.JoinHostPort(BConfig.Listen.AdminAddr, fmt.Sprintf("%d", BConfig.Listen.AdminPort))
}
logs.Info("Admin server Running on %s", addr)
admin.HttpServer.Run(addr)
@ -102,6 +103,7 @@ func registerAdmin() error {
// copy config to avoid conflict
adminCfg := *BConfig
adminCfg.Listen.EnableHTTPS = false
adminCfg.Listen.EnableMutualHTTPS = false
beeAdminApp = &adminApp{
HttpServer: NewHttpServerWithCfg(&adminCfg),
}