From b93641af9306aed281aa646e926b0997fce699bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Wed, 30 Jan 2019 15:36:49 +0000 Subject: [PATCH] fix(proxy): check for trailing slash on listen.prefix when proxy is on When constructing proxy path to listen on for requests to pass upstream check if listen.prefix ends with / and if no inject it. Fixes #386 --- proxy.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/proxy.go b/proxy.go index cac88197e..b8da77e49 100644 --- a/proxy.go +++ b/proxy.go @@ -15,7 +15,11 @@ import ( ) func proxyPathPrefix(name string) string { - return fmt.Sprintf("%sproxy/alertmanager/%s", config.Config.Listen.Prefix, name) + maybeSlash := "" + if !strings.HasSuffix(config.Config.Listen.Prefix, "/") { + maybeSlash = "/" + } + return fmt.Sprintf("%s%sproxy/alertmanager/%s", config.Config.Listen.Prefix, maybeSlash, name) } func proxyPath(name, path string) string {