Docs › Administration
HTTPS and reverse proxies
Omnibus serves plain HTTP on one port. To reach it over HTTPS, or from outside your home, put a reverse proxy such as nginx, Caddy or Traefik in front of it: the proxy holds the certificate and passes requests through. A few settings change when you do.
The examples on this page give Omnibus a host name of its own, books.example.com, served on the standard HTTPS port 443. Replace it with yours.
What to change in Omnibus
-
In your compose file, set the address people will use and turn secure cookies on:
environment: OMNIBUS_PUBLIC_ORIGIN: "https://books.example.com" OMNIBUS_SECURE_COOKIES: "1" # or remove the line; on is the default -
Keep other machines from reaching Omnibus without going through the proxy. If the proxy runs on the same host, publish the port on the loopback address only:
ports: - "127.0.0.1:3000:3000"If the proxy runs in Docker on the same network as Omnibus, you can remove
ports:altogether and point the proxy atomnibus:3000. Run
docker compose up -d, set up the proxy with one of the examples below, and openhttps://books.example.com.
OMNIBUS_PUBLIC_ORIGIN- The address in the browser, exactly:
https://, the host name, and a port only if it isn't 443. Omnibus refuses changes from a browser page whose address is neither listed here nor theHostthe proxy passes on, so this is what keeps saving working behind a proxy that rewritesHost. It also gives the scheme and port to links Omnibus builds itself. Separate several addresses with commas. OMNIBUS_SECURE_COOKIES- With secure cookies on, browsers send the sign-in cookie only over HTTPS. Signing in over plain
http://stops working (except onlocalhost), so use the HTTPS address everywhere once you switch.
The proxy must also pass the original Host header and an X-Forwarded-Proto header. Omnibus builds some full links itself, such as the download and cover links it gives a Kobo, and reads the address and scheme from those two headers. Caddy and Traefik send both on their own; the nginx example sets them.
nginx
server {
listen 443 ssl;
server_name books.example.com;
ssl_certificate /etc/letsencrypt/live/books.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/books.example.com/privkey.pem;
client_max_body_size 0; # no size limit on uploads (nginx's default is 1 MB)
proxy_read_timeout 600s; # a big upload is scanned before Omnibus answers
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $remote_addr;
}
location = /metrics {
return 404;
}
}
server {
listen 80;
server_name books.example.com;
return 301 https://$host$request_uri;
}
Change 127.0.0.1:3000 to omnibus:3000 if nginx runs in Docker beside Omnibus, and the certificate paths to wherever yours are. Setting X-Forwarded-For to $remote_addr replaces anything a client sent in that header, which is what real client addresses needs.
Caddy
A short Caddyfile is enough, and Caddy fetches and renews the certificate itself:
books.example.com {
respond /metrics 404
reverse_proxy omnibus:3000
}
Use localhost:3000 instead of omnibus:3000 if Caddy runs on the host rather than in Docker. Caddy's defaults already suit Omnibus: it puts no limit on upload size, passes the Host header, sets X-Forwarded-For and X-Forwarded-Proto, and ignores those headers when a client sends them itself.
Traefik
With Traefik watching Docker, add labels to the Omnibus service and remove its ports::
services:
omnibus:
# …everything else as before, without ports:
labels:
- "traefik.enable=true"
- "traefik.http.routers.omnibus.rule=Host(`books.example.com`)"
- "traefik.http.routers.omnibus.entrypoints=websecure"
- "traefik.http.routers.omnibus.tls.certresolver=letsencrypt"
- "traefik.http.services.omnibus.loadbalancer.server.port=3000"
websecure and letsencrypt are the names of the HTTPS entrypoint and certificate resolver in your own Traefik setup; use yours. Traefik v3 stops reading a request body after 60 seconds, which cuts off a large upload on a slow connection. Raise it on the entrypoint in Traefik's own configuration, for example with this command-line flag:
--entrypoints.websecure.transport.respondingTimeouts.readTimeout=600s
Large uploads
When someone adds a book from the app, the whole file goes through the proxy, and an audiobook can be gigabytes. Omnibus then scans it into the library before it answers. Three things have to allow for that:
- Size. Omnibus sets no upload limit of its own unless you set
OMNIBUS_MAX_UPLOAD_BYTES, so the proxy shouldn't either. nginx refuses anything over 1 MB until you setclient_max_body_size 0. Caddy and Traefik set no limit. - Time. A slow upload, and the scan after it, can take minutes. Raise nginx's
proxy_read_timeout(60 seconds by default) and Traefik'sreadTimeout(60 seconds in v3). Caddy's defaults already allow it. - Space. Omnibus stages each upload in its temporary folder before filing it, so that folder needs room for the largest file. Inside the container that's
/tmp; setTMPDIRto a folder on a bigger volume if it fills up.
Real client addresses
Omnibus limits how often one address can try to sign in, search or upload. Behind a proxy, every request seems to come from the proxy, so the whole household shares one allowance: ten sign-in attempts a minute between everyone, for example. The log also shows the proxy's address instead of the reader's.
To use each reader's real address instead, set:
OMNIBUS_TRUST_FORWARDED_FOR: "1"
Omnibus then takes the address from the last entry in the X-Forwarded-For header, the one your proxy added. Turn it on only when all three are true:
- exactly one proxy sits in front of Omnibus. Behind a chain, such as a CDN in front of nginx, the last entry is the inner proxy and everyone shares its allowance again;
- the proxy replaces any
X-Forwarded-Fora client sends, as the nginx and Caddy examples above do; - nothing can reach Omnibus without going through the proxy, as the ports step arranges.
Kobo and other ports
A Kobo leaves the port off the requests it sends. On port 443 that changes nothing. If your HTTPS address uses another port, such as https://books.example.com:8443, list that exact address in OMNIBUS_PUBLIC_ORIGIN; Omnibus takes the port for the Kobo's download and cover links from the entry with the same scheme and host.
The sync URL under Settings › Devices is built from the address you have Omnibus open at. Open Omnibus at its HTTPS address before you copy it. A Kobo you set up before the switch keeps syncing to its old address until you change api_endpoint in its config file, as Kobo describes.
Keep /metrics private
If you turn on Prometheus metrics, keep /metrics off the public internet even though it needs a token. The examples above already answer 404 for it at the proxy (location = /metrics in nginx, respond /metrics 404 in Caddy). Let Prometheus scrape the container directly on your own network instead.
If something's wrong
- Saving changes, or signing in again, answers 403
OMNIBUS_PUBLIC_ORIGINdoesn't match the address in the browser, scheme and port included, and the proxy isn't passing the originalHostheader.- Signing in does nothing
- You're on plain
http://with secure cookies on. Use the HTTPS address, or setOMNIBUS_SECURE_COOKIESto0while you're still on HTTP. - Uploads fail straight away with 413
- The proxy's size limit, usually nginx's
client_max_body_size. - Large uploads fail after a minute or so with 504
- The proxy's timeout:
proxy_read_timeoutin nginx,readTimeoutin Traefik. - Readers get "too many requests" when signing in
- Everyone shares the proxy's allowance. See Real client addresses.
- A Kobo syncs but books won't download
- The server's address uses a port other than 443 and isn't listed in
OMNIBUS_PUBLIC_ORIGIN, or the proxy isn't passingHostandX-Forwarded-Proto.
More in Troubleshooting.