fix: set correct web.external-url and web.route-prefix #302
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
Closes #293.
Currently, we were setting
web.external-url
to the internal, not external url because the external one from Traefik contains the path; this messes things up and makes Alertmanager unreachable.The
route-prefix
is deduced from theexternal-url
(by default), meaning that if Traefik is serving Alertmanager at1.2.3.4/am
, Alertmanager will then prefix all of its endpoints with/am
, redirecting the user to1.2.3.4/am/am
. This will happen recursively, leading toERR_TOO_MANY_REDIRECTS
.Solution
There is a separate config option in the
alertmanager
binary to set theroute-prefix
; setting that to/
allows us to avoid the infinite redirect issue, and to correctly link to Alertmanager when using an external URL.Here's an example alert using
{{ .ExternalURL }}
in its message.Before this PR:
❌ (related** to Traefik, but using internal URL)
After this PR:
✅ (not related to Traefik, correctly displaying the internal url)
✅ (related to Traefik, correctly displaying the external url)
Testing Instructions
Follow the reproduction steps in the linked issue, and verify that the alerts are sent with the correct
{{ .ExternalUrl }}
.