Skip to content

Commit

Permalink
feat(ui): check proxy empty config (#5790)
Browse files Browse the repository at this point in the history
  • Loading branch information
richardlt committed Apr 14, 2021
1 parent 0a1ebf7 commit 14e10a3
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions engine/ui/ui_router.go
Expand Up @@ -30,9 +30,15 @@ func (s *Service) initRouter(ctx context.Context) {
r.Handle(s.Cfg.DeployURL+"/mon/metrics/all", nil, r.GET(service.GetMetricsHandler))

// proxypass
r.Mux.PathPrefix(s.Cfg.DeployURL + "/cdsapi").Handler(s.getReverseProxy(s.Cfg.DeployURL+"/cdsapi", s.Cfg.API.HTTP.URL))
r.Mux.PathPrefix(s.Cfg.DeployURL + "/cdshooks").Handler(s.getReverseProxy(s.Cfg.DeployURL+"/cdshooks", s.Cfg.HooksURL))
r.Mux.PathPrefix(s.Cfg.DeployURL + "/cdscdn").Handler(s.getReverseProxy(s.Cfg.DeployURL+"/cdscdn", s.Cfg.CDNURL))
if s.Cfg.API.HTTP.URL != "" {
r.Mux.PathPrefix(s.Cfg.DeployURL + "/cdsapi").Handler(s.getReverseProxy(s.Cfg.DeployURL+"/cdsapi", s.Cfg.API.HTTP.URL))
}
if s.Cfg.HooksURL != "" {
r.Mux.PathPrefix(s.Cfg.DeployURL + "/cdshooks").Handler(s.getReverseProxy(s.Cfg.DeployURL+"/cdshooks", s.Cfg.HooksURL))
}
if s.Cfg.CDNURL != "" {
r.Mux.PathPrefix(s.Cfg.DeployURL + "/cdscdn").Handler(s.getReverseProxy(s.Cfg.DeployURL+"/cdscdn", s.Cfg.CDNURL))
}

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

0 comments on commit 14e10a3

Please sign in to comment.