Skip to content

A private YouTube client: self-hosted web version (one docker compose) and native apps for Android, Windows, macOS, Linux and iPad/iPhone. No Google account, no tracking. Not affiliated with YouTube or Google.

1.8 KB
Raw Blame
# TubeHaus behind Caddy. Replace tube.example.com and the paths/ports.
#   web app     /srv/tubehaus/web   (the "web" folder of this repo)
#   TubeHaus    127.0.0.1:3010      (server/tubehaus_server.py: the app's API and its own YouTube engine)
#
# TubeHaus has no accounts. Put your own login in front of everything
# (forward_auth to Authelia/Authentik/..., or basic_auth) before exposing it.

tube.example.com {
	encode zstd gzip

	# privacy and hardening: no referrer to other sites, no FLoC/Topics, no MIME sniffing,
	# no framing by other sites, and keep search engines out of a private instance
	header {
		Referrer-Policy same-origin
		X-Content-Type-Options nosniff
		X-Frame-Options SAMEORIGIN
		Permissions-Policy "interest-cohort=(), browsing-topics=()"
		-Server
	}
	handle /robots.txt {
		respond <<TXT
			User-agent: *
			Disallow: /
			TXT 200
	}

	# --- your login goes here, e.g.
	# basic_auth {
	# 	me $2a$14$...   # caddy hash-password
	# }

	# the app's own files
	handle /y/* {
		root * /srv/tubehaus/web
		header Cache-Control "no-cache"
		file_server
	}

	# page navigations open the app; everything else (API, thumbnails, streams) goes to the TubeHaus server below
	@page {
		method GET HEAD
		path / /watch /results /shorts /shorts/* /channel/* /c/* /user/* /@* /playlist /feed/* /settings /hashtag/*
		header Accept *text/html*
		not path /feed/channel/* /feed/playlist/* /feed/private* /feed/webhook/*
		not query classic=*
	}
	handle @page {
		root * /srv/tubehaus/web
		header Cache-Control "no-cache"
		rewrite * /index.html
		file_server
	}

	# everything else: the TubeHaus server (its API, YouTube's answers in Invidious' shapes,
	# the video streams, captions and pictures). flush_interval -1: streams pass as they come
	handle {
		reverse_proxy 127.0.0.1:3010 {
			flush_interval -1
		}
	}
}