Latest Review
Photo of the back of the iPhone 16 Pro Max in its box
September 27, 2024
Latest App Update
Cover for the app 4077: An Unofficial M*A*S*H Trivia app.
May 24, 2024
Apple Intelligence
Header image with the text 'Apple Intelligence: Writing Tools’ with a gradient of colors
October 30, 2024

Blocking the .zip Top Level Domain with an iOS Content Blocker

Screenshot of Safari blocking the URL 'win.zip' using a content blocker.

A few years ago Apple introduced the ability for a new type of application, content blockers. Content blockers are aptly named in that they will help you block content on the internet. The reason why you may want to block content can vary, and content blockers can help allow you to block exactly what you want to block.

The file format for the data for a content blocker is JSON. Each entry consists of two parts, a "trigger" and an "action".

Google has recently made a few new top-level domains, or TLDs, available for registration. The two problematic ones are ".zip", and ".mov". Bleeping Computer has a good write up on how these could be used in a malicious nature to trick users into visiting a site where they can get infected. The issue with these domains, as opposed to other domains, is that the ".zip" and ".mov" extensions are used as file type extensions and this could be the cause of confusion.

If you want to block a top level domain you can use the following code to block .zip domains, but still be able to download .zip files from other sites.

{
    "trigger": {
            "url-filter": ".*\.zip\/"
    },
    "action": {
        "type": "block",
    }
}

The reason that .zip domains are blocked, but files work is due to the " / " in the "url-filter". The ".zip" will match .zip domains. Domains will have a trailing forward slash, whereas files will not. The "url-filter" trigger above will match the trailing slash.

I am not sure how many people will do this, but I am providing the code should anyone want to block the .zip, or .mov top level domains.

For more information about content blockers be sure to check out Apple’s documentation site.

Tags: