diff --git a/configs/milvus.yaml b/configs/milvus.yaml index a05cf640a5..4b31fd9bc4 100644 --- a/configs/milvus.yaml +++ b/configs/milvus.yaml @@ -354,6 +354,7 @@ proxy: hstsMaxAge: 31536000 # Strict-Transport-Security max-age in seconds hstsIncludeSubDomains: false # Include subdomains in Strict-Transport-Security enableHSTS: false # Whether to enable setting the Strict-Transport-Security header + enableWebUI: true # Whether to enable setting the WebUI middleware on the metrics port ip: # TCP/IP address of proxy. If not specified, use the first unicastable address port: 19530 # TCP port of proxy internalPort: 19529 diff --git a/internal/http/server.go b/internal/http/server.go index a9f53c9ba7..87d55873d4 100644 --- a/internal/http/server.go +++ b/internal/http/server.go @@ -103,7 +103,9 @@ func registerDefaults() { Handler: GetStaticHandler(), }) - RegisterWebUIHandler() + if paramtable.Get().HTTPCfg.EnableWebUI.GetAsBool() { + RegisterWebUIHandler() + } } func RegisterStopComponent(triggerComponentStop func(role string) error) { diff --git a/pkg/util/paramtable/http_param.go b/pkg/util/paramtable/http_param.go index 22751781b8..3f896c15c5 100644 --- a/pkg/util/paramtable/http_param.go +++ b/pkg/util/paramtable/http_param.go @@ -26,6 +26,7 @@ type httpConfig struct { HSTSMaxAge ParamItem `refreshable:"false"` HSTSIncludeSubDomains ParamItem `refreshable:"false"` EnableHSTS ParamItem `refreshable:"false"` + EnableWebUI ParamItem `refreshable:"false"` } func (p *httpConfig) init(base *BaseTable) { @@ -110,4 +111,13 @@ func (p *httpConfig) init(base *BaseTable) { Export: true, } p.EnableHSTS.Init(base.mgr) + + p.EnableWebUI = ParamItem{ + Key: "proxy.http.enableWebUI", + DefaultValue: "true", + Version: "v2.5.14", + Doc: "Whether to enable setting the WebUI middleware on the metrics port", + Export: true, + } + p.EnableWebUI.Init(base.mgr) } diff --git a/pkg/util/paramtable/http_param_test.go b/pkg/util/paramtable/http_param_test.go index 495a9c9a6c..2aabb50ebe 100644 --- a/pkg/util/paramtable/http_param_test.go +++ b/pkg/util/paramtable/http_param_test.go @@ -31,4 +31,5 @@ func TestHTTPConfig_Init(t *testing.T) { assert.Equal(t, cfg.Port.GetValue(), "") assert.Equal(t, cfg.AcceptTypeAllowInt64.GetValue(), "true") assert.Equal(t, cfg.EnablePprof.GetAsBool(), true) + assert.Equal(t, cfg.EnableWebUI.GetAsBool(), true) }