PSA: Youtube is blocking auto-embed requests from many datacenters globally. (Our Singapore datacenter being one of them.)
If you’ve been having issue with auto-embed pasted Youtube urls into your editor, it’s not your site or even your web-server.
We have a few mitigation tactics for this issue. (Will also update this if we think of others.)
This issue is happening with many datacenters and VPS providers in the past week or so (globally). Youtube is blocking requests from many networks due to “suspicious activity”. I think they’re trying to cut down on bots but accidentally blocking legitimate requests (like WP embed).
Many people have noticed that they seem to be blocking on ipv6. So if you force all requests through ipv4, that seems to do the trick. Alternatively, you could also ask for your own ipv6 address block (which our datacenter was happy to provide). But be careful, it might affect other services on the same server.
In any case, I suspect our datacenter is probably already trying to get it handled and unblocked due to many other clients already complaining as well.
Possible workarounds/solutions:
functions.php snippetadd_action( 'http_api_curl', function( $curl_handle ) {
curl_setopt( $curl_handle, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );
});
- Try the code hack above! Paste that into your theme functions.php.
- You can still use the embed Youtube videos MANUALLY. The auto-embed function doesn’t work, but pasting in the html embed code manually still works. (Of course, it’s not ideal because of height/width but perhaps you can pick a wider width which is then downsized in mobile). This might be ok while we wait out an update from our datacenter.
- Managed hosting clients can be temporarily moved to our Australian server. And then even move you back later if need be. Australia to Singapore is only about 100ms extra DNS time.
- Dedicated VPS clients can be switched to a new IP. Unfortunately, mass ranges of IP’s are blocked. So we’ll have to try swapping and swapping until we get one that works. (Don’t worry, we’ll handle that work for you.)
- Disabling ipv6 – this is something we will play with but I think it won’t be necessary.
In the meanwhile, you should check your older posts to see if their Youtube embeds stop working. Also…enabling or disabling Cloudflare proxy doesn’t help. It’s a datacenter issue.
Reference links:
Leave a Reply