Skip to content

Commit 14e10a3

Browse files
authored
feat(ui): check proxy empty config (#5790)
1 parent 0a1ebf7 commit 14e10a3

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

engine/ui/ui_router.go

+9-3
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,15 @@ func (s *Service) initRouter(ctx context.Context) {
3030
r.Handle(s.Cfg.DeployURL+"/mon/metrics/all", nil, r.GET(service.GetMetricsHandler))
3131

3232
// proxypass
33-
r.Mux.PathPrefix(s.Cfg.DeployURL + "/cdsapi").Handler(s.getReverseProxy(s.Cfg.DeployURL+"/cdsapi", s.Cfg.API.HTTP.URL))
34-
r.Mux.PathPrefix(s.Cfg.DeployURL + "/cdshooks").Handler(s.getReverseProxy(s.Cfg.DeployURL+"/cdshooks", s.Cfg.HooksURL))
35-
r.Mux.PathPrefix(s.Cfg.DeployURL + "/cdscdn").Handler(s.getReverseProxy(s.Cfg.DeployURL+"/cdscdn", s.Cfg.CDNURL))
33+
if s.Cfg.API.HTTP.URL != "" {
34+
r.Mux.PathPrefix(s.Cfg.DeployURL + "/cdsapi").Handler(s.getReverseProxy(s.Cfg.DeployURL+"/cdsapi", s.Cfg.API.HTTP.URL))
35+
}
36+
if s.Cfg.HooksURL != "" {
37+
r.Mux.PathPrefix(s.Cfg.DeployURL + "/cdshooks").Handler(s.getReverseProxy(s.Cfg.DeployURL+"/cdshooks", s.Cfg.HooksURL))
38+
}
39+
if s.Cfg.CDNURL != "" {
40+
r.Mux.PathPrefix(s.Cfg.DeployURL + "/cdscdn").Handler(s.getReverseProxy(s.Cfg.DeployURL+"/cdscdn", s.Cfg.CDNURL))
41+
}
3642

3743
// serve static UI files
3844
r.Mux.PathPrefix("/docs").Handler(s.uiServe(http.Dir(s.DocsDir), s.DocsDir))

0 commit comments

Comments
 (0)