How to serve Flare under a sub-path
Serve Flare at https://example.com/flare/ behind a reverse proxy instead of
giving it its own (sub)domain. The dashboard, the API, the SSO callbacks and the
links in alert notifications all pick up the one FLARE_BASE_PATH setting.
Prerequisites
- The standalone Docker deployment (run standalone). The setting is read by the published images, so no rebuild is needed.
- A reverse proxy (nginx, Caddy, Traefik, …) in front of Flare that terminates
TLS for
example.com.
Steps
Pick the prefix. It must start with
/, must not end with one, and may have several segments:/flare,/tools/flare. Leaving it empty serves Flare at the root, as before.Set it for both containers and point the other URLs at the public address, in a
docker-compose.override.ymlnext todocker-compose.yml:services: api: environment: Flare__BasePath: /flare Cors__AllowedOrigins__0: https://example.com Alerting__PublicUrl: https://example.com/flare alert-worker: environment: Alerting__PublicUrl: https://example.com/flare dashboard: environment: FLARE_BASE_PATH: /flare PUBLIC_API_URL: https://example.com/flarePUBLIC_API_URLis the prefix only: the dashboard appends/api/...to it, so the API ends up athttps://example.com/flare/api/. PuttingFLARE_BASE_PATH=/flarein.envsets the two base-path variables, but not the URLs, which are fixed indocker-compose.yml, so use the override file.Route both prefixes in the proxy. Do not strip the prefix for the dashboard; for the API either way works. An nginx example:
location /flare/api/ { proxy_pass http://127.0.0.1:8080; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; # live tail is a WebSocket proxy_set_header Connection $connection_upgrade; proxy_set_header Host $host; } location /flare/ { proxy_pass http://127.0.0.1:7777; proxy_set_header Host $host; }Without a trailing slash and URI on
proxy_pass, nginx forwards the request path unchanged. If your proxy strips/flare/apibefore forwarding, the API copes: it assumes the prefix fromFlare__BasePatheither way.Restart the stack and open
https://example.com/flare/.
If you sign in with Entra ID or OpenID Connect, the redirect URI shown on the
authentication settings page now includes the prefix (for example
https://example.com/flare/signin-oidc-generic). Register that exact value
with your identity provider.
OTLP ingestion (ports 4317 and 4318) is not affected. Point your apps at those ports as before.
Do not redirect OTLP traffic. Flare.Ingest never issues redirects itself, but the
OpenTelemetry .NET exporter stopped following HTTP redirects in 1.20.1, so a
proxy that answers http:// with a 301 or 308 to https:// makes every export
from those clients fail and the data is lost without an error in Flare. Terminate
TLS on the OTLP port (or on a dedicated OTLP host), give apps the https://
address directly, and keep any HTTP-to-HTTPS redirect to the dashboard host.
Troubleshooting
- Every page 404s. The dashboard was started without
FLARE_BASE_PATH, or the proxy strips/flare/before forwarding to it. The dashboard needs the full path. - The page loads but every API call fails.
PUBLIC_API_URLshould behttps://example.com/flare, nothttps://example.com/flare/api. ForCors__AllowedOrigins__0, only the origin counts:https://example.com,https://example.com/andhttps://example.com/flareall allowhttps://example.com. - Notification links point at the wrong place.
Alerting__PublicUrlmust include the prefix. - The dashboard container reports unhealthy. Its health check requests
<FLARE_BASE_PATH>/inside the container; make sure the variable is set on thedashboardservice, not only onapi.
Last updated: