Skip to content

plugins/rst: Set referrerpolicy for embedded YouTube#54

Merged
SmithChart merged 1 commit intopengutronix:masterfrom
SmithChart:rst-youtube-referer
Nov 21, 2025
Merged

plugins/rst: Set referrerpolicy for embedded YouTube#54
SmithChart merged 1 commit intopengutronix:masterfrom
SmithChart:rst-youtube-referer

Conversation

@SmithChart
Copy link
Member

@SmithChart SmithChart commented Nov 21, 2025

YouTube seems to have tightened their policy and now requires us to send a referrer header when embedding YouTube inside an iframe:

API Clients that use the YouTube embedded player (including the YouTube
IFrame Player API) must provide identification through the HTTP Referer
request header. In some environments, the browser will automatically set
HTTP Referer, and API Clients need only ensure they are not setting the
Referrer-Policy in a way that suppresses the Referer value.
YouTube recommends using strict-origin-when-cross-origin Referrer-Policy,
which is already the default in many browsers.

https://developers.google.com/youtube/terms/required-minimum-functionality#embedded-player-api-client-identity

So let's set the referrer policy on the iframe accordingly.

To test this locally with the live-server one can add this header to the template to simulate a web-server sending a no-referrer policy: <meta name="referrer" content="no-referrer">.

YouTube seems to have tightened their policy and now requires us to send
a referrer header when embedding YouTube inside an iframe:

> API Clients that use the YouTube embedded player (including the YouTube
> IFrame Player API) must provide identification through the HTTP Referer
> request header. In some environments, the browser will automatically set
> HTTP Referer, and API Clients need only ensure they are not setting the
> Referrer-Policy in a way that suppresses the Referer value.
> YouTube recommends using strict-origin-when-cross-origin Referrer-Policy,
> which is already the default in many browsers.

https://developers.google.com/youtube/terms/required-minimum-functionality#embedded-player-api-client-identity

So let's set the referrer policy on the iframe accordingly.

Signed-off-by: Chris Fiege <cfi@pengutronix.de>
Copy link
Member

@Bastian-Krause Bastian-Krause left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me. I assume you've tested this, so ack.

@SmithChart SmithChart merged commit 486b53c into pengutronix:master Nov 21, 2025
1 of 7 checks passed
@SmithChart SmithChart deleted the rst-youtube-referer branch November 21, 2025 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants