轻松修复YouTube错误153,网站视频播放器配置错误问题

Search
Article List
Article List

一个客户反馈Youtube视频在网站无法播放,提示“在YouTube 上观看此视频, 错误 153, 视频播放器配置错误” 或者英文提示"Watch video on YouTube, Error 153Video, player configuration error"。

screenshot121150

 

修复YouTube错误153方法

小迪研究了下发现是“Referrer-Policy”标头设置为“same-origin”,不发送​ Referrer 头给Youtube,所以导致无法播放视频。

只要改成 “add_header Referrer-Policy "strict-origin-when-cross-origin" always;”,Youtube正常播放↓。

screenshot122020

 

宝塔如何添加/修改“Referrer-Policy”标头

使用宝塔面板的话,在网站的配置文件里面,“ #SECURITY-HEADERS-START” 或者 “ #SSL-END” 下方添加下面代码就行。

add_header Referrer-Policy "strict-origin-when-cross-origin" always;

下图是添加代码后的样子

screenshot122641

建议在Nginx里面点一下“重载配置”,让修改生效。

screenshot123027

 

网站本身如何添加/修改“Referrer-Policy”标头

其实在网站里面也能添加/修改“Referrer-Policy”标头,例如WP网站可以安装相应插件控制,也可以添加自定义代码到functions.php文件控制。

默认情况下WP网站无法控制“Referrer-Policy”标头,如果你没额外去弄过,那就不用管。如果你额外调整过,手动改下就行。

 

 

Cloudflare如何添加/修改“Referrer-Policy”标头

只是在宝塔面板/网站改不够,因为CDN的优先级更高,会覆盖掉宝塔面板/网站的设置。需要在CDN里面修改,下面以Cloudflare为例子说明。

下图位置 “添加安全性标头” 需要保持关闭,如果启用就会自动设置网站“Referrer-Policy”标头为“same-origin”,Youtube视频会打不开。

screenshot125220

其它CDN不做讲解,自己了解。有些CDN没有控制“Referrer-Policy”标头功能,不用管。

 

Comments :

发表评论

Note: Please don't input the URL beginning with "https://", or it will be automatically blacked out by the firewall.

Comments :

发表评论

Note: Please don't input the URL beginning with "https://", or it will be automatically blacked out by the firewall.

Chat
  • WeChat customer service
Quick login without registration

Enter your username and password to log in