Support

Admin Tools for WordPress

#37245 YouTube posts blocked

Posted in ‘Admin Tools for WordPress’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

WordPress version
6.0
PHP version
7.4.29
Admin Tools version
1.5.7

Latest post by nicholas on Wednesday, 08 June 2022 13:03 CDT

tmichel

Please look at the bottom of this page (under Support Policy Summary) for our support policy summary, containing important information regarding our working hours and our support policy. Thank you!

There are two YouTube posts that are being blocked by Server protection/Site protection.

Post: curl "https://www.youtube.com/api/stats/atr?ns=

Post: curl "https://www.youtube.com/youtubei/v1/log_event?alt=json&

How do I allow these. Through the CORS header?

nicholas
Akeeba Staff
Manager

There is something missing in your description: what exactly you are doing. I see you gave us a partial cURL command line. cURL is used to retrieve information from a remote site. The .htaccess file on your server — this is what the .htaccess Maker generates — cannot block a command line retrieving information from a remote site. Commands running in a shell don't go through the web server.

You are either making an assumption that the .htaccess Maker blocks something it cannot or you are not giving us adequate and accurate information to help you. Unfortunately, with the information we do have that's all I can tell you.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

nicholas
Akeeba Staff
Manager

You are still not telling me what you are trying to do. Your screenshot at least contains the URL to your site (https://gvcporphans.org) which allows me to see what is going on. That's a good thing because I am very good at technical support and really bad at mind reading.

So, let's rephrase your ticket:

You are trying to embed a YouTube video on your site's homepage but it doesn't work on Safari. You assumed this happens because of the .htaccess Maker's Site Protection rules without trying to reproduce your issue by replacing your .htaccess file with the contents of the default htaccess.txt shipped with Joomla and without trying to access your site from a different browser and device without any browser extensions loaded.

As I can see by accessing your site in Safari and Edge the embedded video displays correctly and plays fine. You can check your access logs; I am pretty sure you don't get a lot of traffic from Athens, Greece so you can easily spot my checking your site's homepage.

Here's what actually happens.

When YouTube loads through an embed it will try to POST some analytics back to the YouTube.com domain using XMLHttpRequest (a.k.a. "AJAX"). Your browser prevents that. If you look at the same screenshots you sent me you will see that it says that the reason for the failure is NS_BINDING_ABORTED. This means that something canceled the load.

Now we'll work with reductio ad absurdum to find out what this is.

Does something on your server block this like you asserted? For starters, we do not see any HTTP headers which could cause that. But let's not trust the expertise of someone who does that for a living for 17 years, let's prove it's not your server i.e. it's not Admin Tools. We know that the video loads perfectly well on Safari and Edge. So what we need to know is whether the .htaccess Maker's Site Protection is enabled. Yes, it is. I know that by trying to access https://gvcporphans.org/components/com_ajax/ajax.php. Without the .htaccess Maker's Site Protection this returns a blank page. With the .htaccess Maker's Site Protection this returns a 403 or 404 page — that's exactly what I get. Therefore we conclude that your video load problems have nothing to do with Admin Tools, the .htaccess Maker and the Site Protection feature.

This leaves us with YouTube's server and your browser. The fact that the video works on my browsers and I see these analytics POST requests going through just fine means YouTube's server is not a problem, as expected.

This leaves us with your browser. Indeed, this is the only difference between my successful viewing the video and your failed viewing the video!

My experience tells me that this is a browser feature or extension which causes this problem. For example uBlock Origin, AdBlock Plus, Privacy Badger and similar privacy / ad-blocking extensions will block analytics tracking. They do that by hooking into the browser's request handling and blocking the request to the analytics gathering endpoint. When they do that you will indeed see Firefox reporting NS_BINDING_ABORTED.

So, here's your problem: it's your browser, namely some anti-tracking / privacy / ad-blocking extension you are using (or a browser feature doing the same).

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

tmichel

Actually the video works fine in my browser as well, I was just trying to remove all requests errors.

This doesn't appear to affect any of the content of the site, so this was just an exercise in completeness.

Actually after installing and configuring Admin Tools, there is much less network error than existed before installing and configuring admin tools.

Yes Nicholas, you have been involved in every aspect of server configuration and set up and have been doing this for 17 years. that is why I file a support ticket, because I believe that if anyone can explain a problem I am having, it would be you.

I am not going to be too worried about this.

Perhaps I could add these URLs to the "allowOrigins": [] in cors-rules.json file in the root. That is if these videos are of any real interest to this site and aren't some artifact of a previous webmasters left over uncollected trash.

I will have to spend a few hours reviewing the proper way to add CORS.

However when I try to access this resource directly I get:

Google:

405. That’s an error.

The request method GET is inappropriate for the URL /youtubei/v1/log_event. That’s all we know.

So adding "allowOrigins":[] will have not any benefit. The problem seems to be an inappropriate formed request to YouTube using the wrong method.

So the referrer is the video that plays on the website. I will have to find out what request is being made and where it is being made that YouTube cannot process.

referrer: https://www.youtube.com/embed/jjFsImVGYsk?feature=oembed

referrer: https://www.youtube.com/embed/jjFsImVGYsk?feature=oembed

 

nicholas
Akeeba Staff
Manager

What I am telling you, and please do read this several times until it registers, is:

THE ROOT CAUSE OF YOUR PROBLEM IS IN YOUR BROWSER AND ITS EXTENSIONS. IT IS NOT YOUR SITE AND ITS SERVER.

There is no network error when I play the video:

screenshot_2022-06-08_at_20.53.13.png

You CAN NOT do anything on your site or server to change the way the visitor's browser and their browser extensions protect them from tracking. That's the whole point.

In any case, this ticket is well outside the scope of our support and the situation has been fully explained to you so I am going to close it now.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!