Reverse Proxy & Subdirectory Deployment
Questarr can be served from a subdirectory (e.g.https://xxx.domain.com/Questarr)
behind a reverse proxy, instead of owning its own subdomain or root path.
How it works
- The client build uses relative asset paths by default and detects its own base path at runtime, so it doesn’t need to know about the subdirectory in advance.
- The server understands an optional
QUESTARR_BASE_PATHenvironment variable. When set, it mounts the entire app (API, WebSocket, and static assets) under that prefix, so a reverse proxy can forward requests straight through without rewriting the path.
QUESTARR_BASE_PATH is only required if you want Questarr itself to
own the prefix (recommended — see below). If you’d rather have your reverse
proxy strip the prefix before forwarding to Questarr, you can leave
QUESTARR_BASE_PATH unset; the client’s runtime base-path detection adapts
either way.
1. Configure Questarr
SetQUESTARR_BASE_PATH to the path you want to serve from (leading slash,
no trailing slash — e.g. /Questarr):
Docker Compose:
docker run:
QUESTARR_BASE_PATH=/Questarr to your .env file.
With this set, Questarr:
- Serves the app and all
/api/*routes under/Questarr/* - Redirects the unprefixed root (
/) to/Questarr/ - Keeps
/api/healthreachable unprefixed too, so container healthchecks (which talk to the container directly, not through the proxy) keep working unmodified - Serves the WebSocket (Socket.IO) connection at
/Questarr/socket.io/
2. Configure your reverse proxy
Point requests under the prefix at the Questarr container/process, without stripping the prefix — Questarr expects to see it.nginx
app below is the Compose service name from this repo’s docker-compose.yml
— substitute your own container/service name if it differs. nginx’s prefix
match only covers /Questarr/..., so add an exact-match redirect for the
bare /Questarr (no trailing slash) case too:
Traefik (labels)
StripPrefix middleware needed — Questarr handles the prefix itself.
Caddy
Caddy’s/Questarr/* matcher is exact-prefix and won’t match the bare
/Questarr (no trailing slash) request, so redirect it explicitly:
3. Trust the proxy (TRUST_PROXY)
Questarr ignores X-Forwarded-For and X-Forwarded-Proto unless you tell it
a reverse proxy sits in front. Behind a proxy, set TRUST_PROXY so that:
- rate limits, including the login limit, count each real client IP instead of treating every request as coming from the proxy;
- session cookies get the
Secureflag when the proxy terminates HTTPS.
Only set it when every request really goes through the proxy. If the Questarr
port is also reachable directly, anyone hitting it can forge
X-Forwarded-For and pick their own IP for the rate limits; prefer the
subnet form then, or bind Questarr to 127.0.0.1 / an internal network. An
invalid value stops startup with an error.
Your proxy must send X-Forwarded-For and X-Forwarded-Proto (the nginx
example above does; Traefik and Caddy do by default).
4. Verify
Visithttps://xxx.domain.com/Questarr/. Login, navigation, API calls, and
real-time download/notification updates should all work normally under the
prefix.
Notes
QUESTARR_BASE_PATHaccepts letters, numbers, hyphens, underscores, and slashes only (e.g./Questarr,/games/questarr). Invalid values fail startup with a clear error, the same way other misconfigured environment variables do.- Changing
QUESTARR_BASE_PATHonly affects the running server — no rebuild is required, since the pre-built Docker image resolves the base path at runtime rather than baking it into the client bundle at build time.