YouTube embeds fail with a 153 error

AI-generated summary of reporting by Simon Willison’s Weblog. Read the original for the full story.

Why it matters

Django sites using SecurityMiddleware's default Referrer-Policy silently break YouTube embeds with Error 153; switching to strict-origin-when-cross-origin fixes it.

Read this as

Simon Willison's blog had a problem where some YouTube videos shown on his site displayed an error instead of playing. The cause was a security setting that stopped his website from telling YouTube who was sending visitors. He changed one line of his website's settings to fix it.

A one-line Django configuration change resolves YouTube Error 153 on embedded videos. Sites relying on Django's SecurityMiddleware default Referrer-Policy of same-origin send no referer to YouTube, violating YouTube's embedded player terms. Organizations running Django with video embeds should verify their SECURE_REFERRER_POLICY setting; the fix carries a minor privacy trade-off, revealing site origin on outbound links.

Django's SecurityMiddleware defaults to Referrer-Policy: same-origin, suppressing the Referer header on cross-origin requests. YouTube's embedded player requires the HTTP Referer for client identification, producing 'Error 153: Video player configuration error'. Fix: set SECURE_REFERRER_POLICY = 'strict-origin-when-cross-origin' in settings.py, which sends only the origin cross-origin. Willison delegated the fix to a GitHub Copilot agent via pull request #562.

Read the original

This summary exists to save you time, not to replace the source.

Key terms

Simon Willison Django YouTube GitHub Copilot Chrome MDN

Was this summary useful?

One click, anonymous. It tells us which summaries to re-run.

Related reading