I want to place Prometheus behind an Apache reverse proxy for authentication and access control. This is for the version of Prometheus that comes with Debian Stretch (
prometheus --version indicates
version 1.5.2+ds (branch: debian/sid, revision: 1.5.2+ds-2+b3)) and for Apache 2.4.
I already have Prometheus listening on
127.0.0.1:9090 (e.g. according to
netstat -tlpn) and I have this in my
<Location "/prometheus"> ProxyPass "http://localhost:9090" ProxyPassReverse "http://localhost:9090" </Location>
However, when I visit
https://my-server.com/prometheus a redirect to
https://my-server.com/graph occurs (by way of HTTP status code 302 and
Location: /graph), which cannot be served by the reverse proxy in its current configuration.
How can I change the configuration for this version of Prometheus) such that a visit to
https://my-server.com/prometheus will successfully redirect to
https://my-server.com/prometheus/graph, i.e. all Prometheus-related "things" will be served under a common URL prefix
UPDATE One thing that currently puzzles me is that Prometheus'
CHANGELOG.md indicates that command line flag
-web.route-prefix was introduced back in version 1.0.0, but the Debian package's
/etc/default/prometheus does not mention this flag, although it mentions many others (as if it would not support it despite ostensibly being based on version 1.5.2).