Skip to content

Configuration

OwnTube is configured with environment variables, in .env or in the environment: block of each service in docker-compose.yml. Apply a change with docker compose up -d. Every variable is listed in Environment variables; this page covers the ones you are likely to need.

Per-user preferences, such as playback quality, captions and SponsorBlock, are set in the app under Settings and apply on every device.

Behind a reverse proxy, set the address people open in the browser:

Terminal window
AUTH_URL=https://tube.example.org
AUTH_TRUST_HOST=true

Without it, sign-in can redirect to the container’s own address.

The web app refreshes trending, subscribed channels and their newest uploads in the background, so pages open from the cache.

Terminal window
OWNTUBE_WARM_INTERVAL_SEC=900 # every 15 minutes; 0 turns it off
OWNTUBE_WARM_REGION=NL # region for trending

Every run makes requests to YouTube. On a server that gets challenged by YouTube, make the interval longer before anything else.

YouTube sometimes answers a server with “Sign in to confirm you’re not a bot”, or revokes stream URLs after a minute. In order of effort:

  1. Use IPv4. GATEWAY_EGRESS_FAMILY=ipv4 is the default in the compose files. YouTube flags whole IPv6 /64 ranges sooner than single IPv4 addresses.

  2. Fewer requests. Make OWNTUBE_WARM_INTERVAL_SEC longer.

  3. SABR from the start. GATEWAY_TRANSPORT=sabr skips the regular stream URLs and streams the way YouTube’s own apps do. Use it when playback stops after about a minute.

  4. PO tokens. Build the gateway with a Chromium that answers YouTube’s attestation challenges:

    services:
    gateway:
    build:
    context: .
    dockerfile: apps/gateway/Dockerfile
    args:
    WITH_PO_BROWSER: "true"
    environment:
    GATEWAY_PO_BROWSER: /usr/bin/chromium
  5. Another address. GATEWAY_PROXY_URL=http://proxy:3128 sends all YouTube traffic through an HTTP proxy, for example on a residential connection.

The gateway keeps thumbnails and avatars on disk and trims the cache every hour to GATEWAY_IMAGE_CACHE_MAX_BYTES (1 GiB by default).

LOG_LEVEL=debug on the web app logs more detail. TZ=Europe/Amsterdam sets the time zone of the log lines.