Skip to content

Reverse proxy

To reach Fret over HTTPS, under your own domain, put it behind a reverse proxy such as Caddy, nginx or Traefik. Two things matter:

  • the live event stream (/api/v1/events) must not be buffered, otherwise the dock stops updating;
  • the proxy must pass the X-Forwarded-Proto header, so that Fret marks its session cookie Secure over HTTPS.

Fret is served from the root of a domain or subdomain (https://fret.example.com/); serving it under a path (https://example.com/fret/) is not supported.

fret.example.com {
reverse_proxy localhost:8080
}

Caddy sets X-Forwarded-Proto and streams server-sent events without buffering on its own.

server {
listen 443 ssl;
server_name fret.example.com;
# ssl_certificate …
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_buffering off; # live event stream
proxy_read_timeout 1h;
}
}

Fret also sends X-Accel-Buffering: no on the event stream, which tells nginx not to buffer it.

With Docker labels:

services:
fret:
image: ghcr.io/sokteam/fret:latest
labels:
- traefik.enable=true
- traefik.http.routers.fret.rule=Host(`fret.example.com`)
- traefik.http.routers.fret.entrypoints=websecure
- traefik.http.routers.fret.tls=true
- traefik.http.services.fret.loadbalancer.server.port=8080

When the proxy runs on the same host, keep Fret off the network:

Terminal window
FRET_ADDR=127.0.0.1:8080

With Docker, publish the port on the loopback interface only: "127.0.0.1:8080:8080".

If the proxy already authenticates you (Authelia, Authentik, oauth2-proxy, basic authentication…), Fret’s own password is redundant. Start Fret with FRET_AUTH=none to turn it off.

Scripts that call the API through the proxy then authenticate with the proxy, not with a Fret token.

The collection port (9666) is not meant to go through the proxy: browsers send Click’n’Load requests to 127.0.0.1:9666 on their own computer.

Built with Kiln