YouTube appears to work despite Block or Warn final action applied

Updated 3 years ago by admin

Applies to Chrome and Opera browsers (November 2021)

It is a common requirement to restrict YouTube (and related services) using the Web Security product Filter Rules, either with a time based, user-coached (warn) or outright block action depending on the network policy.

It is important to note that YouTube uses a Service Worker (part of the Progressive Web App framework) that will try and serve content from the local browser cache even if the connection is interrupted. This is to try and maintain the user experience for low speed and poor quality connections but it will also kick-in when a proxy blocks certain web requests the application needs.

The end result is that YouTube will show an error message indicating that you are offline and it will appear to load the application (header, navigation bar). In actual fact, none of the application is working due to the filter rule blocking the background HTTP requests.

The reason the standard block page template is not displayed is due to the way the Service Worker attempts to load static assets from the cache (images, icons, styles, text). If the user (or browser) previously had access to YouTube, prior to the block rule taking effect, then the Service Worker will attempt to load the page from the cache without requiring a full page load. The browser therefore doesn't reload and there is no opportunity to replace the page contents with the standard block page.

This can be confirmed by pressing F12 and inspecting the Network tab which will contain requests that have been rejected with a 502 error code (the Web Security block page):

To resolve this issue, force the browser to clear its cache by using Ctrl + F5 or using the Clear Contents option in the browser settings. This will clear the cache and the service worker, and the standard block page will appear as expected the next time YouTube is visited in a browser.

If you are using a warn or quota based rule, then this behaviour will reoccur every time the browser is able to access YouTube without restriction e.g. after passing through the warning page or during a time when the site is allowed.

Please note that when the YouTube application is in this state then its features are disabled and the application is not usable. Therefore it has the same result as a standard block action.


How did we do?