diff --git a/pkg/service/v0/service.go b/pkg/service/v0/service.go index 3ddf5589e..c6535f621 100644 --- a/pkg/service/v0/service.go +++ b/pkg/service/v0/service.go @@ -72,11 +72,11 @@ func (p Phoenix) getPayload() (payload []byte, err error) { p.config.Phoenix.Config.ExternalApps = []config.ExternalApp{ { ID: "accounts", - Path: "https://localhost:9200/accounts.js", + Path: singleJoiningSlash(p.config.Phoenix.Config.Server, "accounts.js"), }, { ID: "settings", - Path: "https://localhost:9200/settings.js", + Path: singleJoiningSlash(p.config.Phoenix.Config.Server, "settings.js"), }, } } @@ -109,6 +109,18 @@ func (p Phoenix) getPayload() (payload []byte, err error) { return } +func singleJoiningSlash(a, b string) string { + aslash := strings.HasSuffix(a, "/") + bslash := strings.HasPrefix(b, "/") + switch { + case aslash && bslash: + return a + b[1:] + case !aslash && !bslash: + return a + "/" + b + } + return a + b +} + // Config implements the Service interface. func (p Phoenix) Config(w http.ResponseWriter, r *http.Request) {