Skip to content

docs: guide for running Prometheus behind a reverse proxy - #3060

Open
locker95 wants to merge 1 commit into
prometheus:mainfrom
locker95:docs/reverse-proxy-guide
Open

docs: guide for running Prometheus behind a reverse proxy#3060
locker95 wants to merge 1 commit into
prometheus:mainfrom
locker95:docs/reverse-proxy-guide

Conversation

@locker95

@locker95 locker95 commented Aug 9, 2026

Copy link
Copy Markdown

Short guide on proxying Prometheus: --web.external-url, Host / X-Forwarded-* headers, nginx and Caddy snippets, and a note about lifecycle/admin paths. Linked from the security model page.

Fixes #2950

Common Host/X-Forwarded-* headers, external-url notes, and a short
warning about lifecycle/admin paths when proxying.

Signed-off-by: Dean Chen <862469039@qq.com>

@jan--f jan--f left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, nice addition! Just a few comments.

Comment on lines +18 to +20
If you terminate TLS or add authentication at a reverse proxy, see
[Running Prometheus behind a reverse proxy](/docs/guides/reverse-proxy/).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If you terminate TLS or add authentication at a reverse proxy, see
[Running Prometheus behind a reverse proxy](/docs/guides/reverse-proxy/).

Not sure this is right place to cross link this. Maybe better places are /docs/guides/tls-encryption.md' and /docs/guides/basic-auth.md`?

Comment on lines +42 to +43
| `Host` | Original host as seen by clients (or the public hostname you intend Prometheus to see) |
| `X-Forwarded-Proto` | `https` when TLS is terminated at the proxy so redirects stay on HTTPS |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Iirc Prometheus uses relative redirects internally. While its good practice to suggest bot headers, the purpose is not quite accurate, as Promteheus doesn't use the information.
Maybe just

Suggested change
| `Host` | Original host as seen by clients (or the public hostname you intend Prometheus to see) |
| `X-Forwarded-Proto` | `https` when TLS is terminated at the proxy so redirects stay on HTTPS |
| `Host` | Original host the client used, not used by Prometheus but good practice |
| `X-Forwarded-Proto` | `https` when TLS is terminated at the proxy, not used by Prometheus but good practice|

If the proxy serves Prometheus under a public hostname or URL prefix, set
[`--web.external-url`](https://prometheus.io/docs/prometheus/latest/command-line/prometheus/)
to that public base URL (including path prefix if any). This is used for
generated links, redirects, and the expression browser.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
generated links, redirects, and the expression browser.
generated links.

I'm not sure about the last two statements. If you're sure about the let me know, otherwise let's err on the side of caution and drop them?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

document recommendations for reverse proxying prometheus

2 participants