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.
The server’s address
Section titled “The server’s address”Behind a reverse proxy, set the address people open in the browser:
AUTH_URL=https://tube.example.orgAUTH_TRUST_HOST=trueWithout it, sign-in can redirect to the container’s own address.
Background refresh
Section titled “Background refresh”The web app refreshes trending, subscribed channels and their newest uploads in the background, so pages open from the cache.
OWNTUBE_WARM_INTERVAL_SEC=900 # every 15 minutes; 0 turns it offOWNTUBE_WARM_REGION=NL # region for trendingEvery run makes requests to YouTube. On a server that gets challenged by YouTube, make the interval longer before anything else.
Gateway
Section titled “Gateway”When YouTube blocks the server
Section titled “When YouTube blocks the server”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:
-
Use IPv4.
GATEWAY_EGRESS_FAMILY=ipv4is the default in the compose files. YouTube flags whole IPv6 /64 ranges sooner than single IPv4 addresses. -
Fewer requests. Make
OWNTUBE_WARM_INTERVAL_SEClonger. -
SABR from the start.
GATEWAY_TRANSPORT=sabrskips the regular stream URLs and streams the way YouTube’s own apps do. Use it when playback stops after about a minute. -
PO tokens. Build the gateway with a Chromium that answers YouTube’s attestation challenges:
services:gateway:build:context: .dockerfile: apps/gateway/Dockerfileargs:WITH_PO_BROWSER: "true"environment:GATEWAY_PO_BROWSER: /usr/bin/chromium -
Another address.
GATEWAY_PROXY_URL=http://proxy:3128sends all YouTube traffic through an HTTP proxy, for example on a residential connection.
Cache size
Section titled “Cache size”The gateway keeps thumbnails and avatars on disk and trims the cache every hour to GATEWAY_IMAGE_CACHE_MAX_BYTES (1 GiB by default).
Logging
Section titled “Logging”LOG_LEVEL=debug on the web app logs more detail. TZ=Europe/Amsterdam sets the time zone of the log lines.