Reverse Proxy & TLS¶
Configure a TLS-terminating reverse proxy in front of Repod to enable HTTPS, expose services on standard ports, and harden the public attack surface.
Why a reverse proxy?¶
Repod exposes three services over plain HTTP by default:
| Service | Default port | Description |
|---|---|---|
| Web interface | 3003 |
React SPA |
| Backend API | 8000 |
FastAPI — called directly by browsers |
| Repository | 80 |
Served by internal Nginx |
Without a reverse proxy:
- Credentials and API tokens travel over the network in plaintext.
- Modern browsers flag plain HTTP sites.
- HSTS cannot be enabled.
- APT/DNF clients are vulnerable to man-in-the-middle attacks.
With a TLS reverse proxy you gain:
- End-to-end encryption (TLS 1.2/1.3).
- HSTS to enforce HTTPS in browsers.
- Standard ports 80/443 — no port suffix in URLs.
- Centralized certificate management (Let's Encrypt or internal CA).
Target architecture¶
┌───────────────────────────────────────┐
│ Reverse Proxy │
Internet ─ :443 ─► │ / → frontend-ui :3003 │
│ /api/* → backend-api :8000 │
─ :80 ─► │ redirect to HTTPS │
└───────────────────────────────────────┘
┌───────────────────────────────────────┐
│ Repository (HTTP OK) │
LAN clients ─ :8085 ─► depot-apt (APT_PORT) │
─ :8080 ─► depot-rpm (RPM_REPO_PORT) │
└───────────────────────────────────────┘
Repository over HTTP
The APT/RPM repository can remain on plain HTTP: the repository metadata is
signed with Repod's key, and apt verifies it (so does dnf with
repo_gpgcheck=1, see Point a machine at your repository).
Migrate to HTTPS only if your security policy requires it.
Before you start¶
1. Free port 80 for the reverse proxy. By default depot-apt publishes
the APT repository on port 80 (APT_PORT=80). That is the port the proxy needs
for its HTTP to HTTPS redirect and for Let's Encrypt, and two programs cannot
listen on the same port of one host. Move the repository to another port (the
TLS overlay of Repod already uses 8085):
2. Decide who can reach the internal ports. BIND_HOST applies to
every port Repod publishes: the web interface (3003), the API (8000),
and the repositories (APT, RPM), the upstream cache and the OCI registry.
| Choice | Effect |
|---|---|
BIND_HOST=127.0.0.1 |
Nothing is reachable from the network except through your proxy. Your machines can no longer run apt update or dnf against Repod directly, unless you also proxy the repository |
BIND_HOST unset (recommended when machines use the repository) |
The repositories stay reachable. Block 3003 and 8000 from outside with the host firewall (ufw or firewalld) |
Rebuild and restart after changing .env:
Option A — Nginx + Let's Encrypt (recommended)¶
Install Nginx and Certbot¶
Obtain the TLS certificate¶
Certbot modifies the Nginx configuration and configures automatic renewal.
Full Nginx configuration¶
Create /etc/nginx/sites-available/repod (Debian/Ubuntu) or
/etc/nginx/conf.d/repod.conf (RHEL/AlmaLinux):
# HTTP → HTTPS redirect
server {
listen 80;
server_name repo.example.com;
return 301 https://$host$request_uri;
}
# Frontend + API over HTTPS
server {
listen 443 ssl http2;
server_name repo.example.com;
ssl_certificate /etc/letsencrypt/live/repo.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/repo.example.com/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers off;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 1d;
# HSTS — enable only after verifying HTTPS works end-to-end
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
# Frontend (React SPA)
location / {
proxy_pass http://127.0.0.1:3003;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# Backend API — forwarded as is: the backend serves /api/v1/...
# (do NOT strip the /api prefix, the backend would answer 404)
location /api/ {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 300s; # allow time for CVE scans
client_max_body_size 512m; # allow large package uploads
# Required for Server-Sent Events (sync / import progress)
proxy_buffering off;
proxy_cache off;
}
}
Enable and reload:
# Debian / Ubuntu
ln -s /etc/nginx/sites-available/repod /etc/nginx/sites-enabled/repod
# All platforms
nginx -t
sudo systemctl reload nginx
One domain for the interface and the API¶
The configuration above already serves both on one domain: the interface on
/, the API on /api/. The browser calls relative addresses
(/api/v1/...), so leave REACT_APP_API_URL empty in .env, as everywhere
else in Repod. Setting it to an absolute address bakes that address into the
JavaScript bundle and breaks access from any other host name.
Option B — Nginx + internal CA / self-signed certificate¶
Useful for intranets or air-gapped environments without public Internet access.
Generate a self-signed certificate¶
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout /etc/ssl/private/repod.key \
-out /etc/ssl/certs/repod.crt \
-subj "/CN=repo.example.com" \
-addext "subjectAltName=DNS:repo.example.com,IP:192.168.1.100"
Replace the ssl_certificate* lines in the Nginx configuration above:
Distribute the certificate to clients¶
Option C — Traefik (Docker-native)¶
Repod supports Traefik in three configurations, depending on who owns the Traefik instance: bundled with Repod, self-rolled with Docker labels, or an existing Traefik you don't control.
C1 — Repod's bundled overlay (recommended)¶
Repod ships a ready-to-use overlay, docker-compose.traefik.yml, plus
traefik/traefik.yml and traefik/dynamic.yml. It's mutually exclusive with
docker-compose.tls.yml (same role — pick one, never both) and reproduces
the same routing (frontend /, direct API on :8443) as the Nginx TLS
overlay.
bash scripts/gen-selfsigned-certs.sh
docker compose -f docker-compose.yaml -f docker-compose.traefik.yml up -d
Why the file provider, not Docker labels
This overlay deliberately uses Traefik's file provider
(traefik/dynamic.yml) instead of its Docker provider. The Docker
provider requires mounting /var/run/docker.sock into the proxy
container — a container with socket access can control every
container on the host, including other tenants' data in SaaS mode.
Repod avoids mounting the Docker socket everywhere else (see the HA and
OCI registry sections of the architecture docs), so the bundled overlay
follows the same rule. The trade-off: adding a new route means editing
traefik/dynamic.yml (hot-reloaded, no restart needed) instead of
adding a label — the same effort as maintaining an Nginx vhost.
Let's Encrypt is supported natively (see the commented block in
traefik/traefik.yml) — Traefik renews certificates itself, no separate
Certbot container required.
C2 — Self-rolled Traefik with Docker labels¶
If you'd rather use Traefik's Docker auto-discovery instead of the bundled file-provider overlay, here is the equivalent setup. This does require Docker socket access for the Traefik container — acceptable for a single-tenant, single-purpose host; weigh it more carefully for a multi-tenant/SaaS deployment (see the callout above).
services:
traefik:
image: traefik:v3.0
command:
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--certificatesresolvers.le.acme.tlschallenge=true"
- "[email protected]"
- "--certificatesresolvers.le.acme.storage=/letsencrypt/acme.json"
ports:
- "80:80"
- "443:443"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "./letsencrypt:/letsencrypt"
restart: unless-stopped
In the Compose file the services are named frontend and backend (frontend-ui and backend-api are their container names), so the label blocks below go under those keys and the build commands use the service name.
frontend:
labels:
- "traefik.enable=true"
- "traefik.http.routers.repod-ui.rule=Host(`repo.example.com`)"
- "traefik.http.routers.repod-ui.entrypoints=websecure"
- "traefik.http.routers.repod-ui.tls.certresolver=le"
- "traefik.http.services.repod-ui.loadbalancer.server.port=80"
backend:
labels:
- "traefik.enable=true"
- "traefik.http.routers.repod-api.rule=Host(`repo.example.com`) && PathPrefix(`/api/`)"
- "traefik.http.routers.repod-api.entrypoints=websecure"
- "traefik.http.routers.repod-api.tls.certresolver=le"
- "traefik.http.services.repod-api.loadbalancer.server.port=8000"
Two details that break the UI if you get them wrong
Traefik reaches a container on its own port inside the Docker network:
80 for frontend-ui (3003 is only the port published on the host).
And do not add a stripprefix middleware: the backend serves /api/v1/....
| Advantage | Disadvantage |
|---|---|
| Zero manual certificate management | Requires Docker socket access |
| Auto-renewal | Verbose label syntax |
| Auto-discovery of services | Extra container to manage |
C3 — Integrating with a Traefik you don't manage¶
Common when deploying on a customer's infrastructure: they already run Traefik (elsewhere on the same Docker host, on a separate host, or as a Kubernetes ingress) and want Repod to sit behind it rather than run its own proxy.
Don't deploy either of the overlays above (docker-compose.traefik.yml
or the labels in C2) — they'd conflict with the existing instance. Instead:
-
Start Repod with the base compose file only — no TLS/proxy overlay:
-
Restrict
frontend-ui/backend-apito the network segment their Traefik can reach (BIND_HOSTin.env, or firewall/network segmentation) — the frontend already proxies/api/to the backend internally, so only one upstream (:3003) needs to be reachable from their proxy. -
Give their team the route to add on their side. If they use Traefik's file provider, this is the whole snippet:
dynamic.yml (their Traefik)http: routers: repod: rule: "Host(`repod.customer.com`)" entryPoints: ["websecure"] service: repod tls: {} services: repod: loadBalancer: servers: - url: "http://<repod-host>:3003"If they use Docker labels instead, and their Traefik can reach Repod's Docker network, the equivalent is a single label block on the
frontendservice (same shape as C2'sfrontendlabels, pointed at their owncertresolver/rule). -
Hand them these three requirements — they're easy to miss and each one breaks something different:
Requirement Why CORS_ORIGINS=https://repod.customer.cominbackend.envWithout it, the frontend's own API calls are rejected by the browser Forward the HostheaderTraefik does this by default (unlike Nginx, which needs an explicit proxy_set_header Host $host) — matters for SaaS tenant resolution, which reads this headerNo request body size limit on the Repod route .deb/.rpmuploads can be large (up to 512 MB); Traefik has no default limit, but a middleware they already run elsewhere might impose oneNo change is needed to Repod's own internal Nginx (
depot-apt/depot-rpm) — those containers keep handling their ownauth_request-based distribution access checks regardless of what reverse proxy sits in front of the whole stack.
Option D — Caddy (minimal configuration)¶
Caddy handles HTTPS automatically with minimal configuration.
repo.example.com {
request_body {
max_size 512MB
}
# Backend API — forwarded as is (the backend serves /api/v1/...)
handle /api/* {
reverse_proxy http://127.0.0.1:8000 {
header_up X-Forwarded-Proto {scheme}
transport http {
read_timeout 300s
}
}
}
# Frontend: everything else
handle {
reverse_proxy http://127.0.0.1:3003
}
}
Caddy obtains and renews Let's Encrypt certificates automatically.
Option E — The bundled Let's Encrypt overlay (Docker)¶
If you already run the TLS overlay (docker-compose.tls.yml) and want Repod's
own nginx-proxy container to hold a Let's Encrypt certificate, Repod ships
docker-compose.letsencrypt.yml. It adds a certbot container that answers
the HTTP-01 challenge through the proxy's port 80, and mounts the issued
certificates into the proxy under /certs/letsencrypt.
What you need:
- a public domain name that points to this machine (
REPOD_DOMAIN); - port 80 reachable from the Internet, for the validation;
docker-compose.tls.ymlloaded together with the overlay;CERTBOT_EMAILandREPOD_DOMAINset in your environment.
After issuance, point nginx/tls-proxy.conf at the new files
(ssl_certificate /certs/letsencrypt/live/<domain>/fullchain.pem; and the
matching privkey.pem): the default configuration still reads
/certs/cert.pem. The exact command sequence for the first issuance and for
renewal is in the header of docker-compose.letsencrypt.yml.
Choose this option only if you want everything inside Docker. On a host that already runs Nginx, Option A is simpler.
Update Repod configuration after enabling HTTPS¶
After enabling the reverse proxy, update environment variables and rebuild the frontend.
.env¶
REACT_APP_REPO_URL is only the address shown in the setup commands of the
Configuration client page, so it must be the address your machines use,
with the repository port. Add BIND_HOST=127.0.0.1 only if you chose it in
Before you start.
backend.env¶
For Traefik inside Docker (bridge network), also include the Docker subnet:
Rebuild the frontend¶
REACT_APP_* variables are baked into the JavaScript bundle at build time:
Verify the configuration¶
# Certificate chain
curl -vI https://repo.example.com 2>&1 | grep -E "SSL|TLS|certificate|issuer"
# HSTS header
curl -sI https://repo.example.com | grep -i strict-transport
# HTTP → HTTPS redirect
curl -I http://repo.example.com
# Expected: 301 Moved Permanently → https://...
# API over HTTPS
curl -s https://repo.example.com/api/v1/setup/status | jq .
# A page of the interface (not only the home page)
curl -sI https://repo.example.com/login | head -1
# The repository, from a machine that uses it
curl -sI http://repo.example.com:8085/repos/dists/depot.gpg | head -1
Certificate renewal¶
| Proxy | Renewal | Action required |
|---|---|---|
| Certbot | Systemd timer every 12 h | None — runs automatically |
| Traefik | Built-in ACME client | None |
| Caddy | Built-in ACME client | None |
| Self-signed | Manual or cron | Schedule annual renewal |
Check Certbot timer status:
Post-configuration checklist¶
| Action | File / Command |
|---|---|
APT_PORT moved off port 80 |
.env |
BIND_HOST chosen on purpose (it also hides the repositories) |
.env |
REACT_APP_API_URL left empty, REACT_APP_REPO_URL set with the repository port |
.env → rebuild frontend |
CORS_ORIGINS updated |
backend.env |
TRUSTED_PROXIES set |
backend.env |
| Frontend rebuilt | docker compose build frontend |
| HSTS header verified | curl -sI https://repo.example.com |
| Port 8000 not exposed | sudo ufw status or firewall-cmd --list-all |