URL filters
Create a filter that analyzes full URLs, while preserving privacy.
Overview
URL filters allow you to filter URL requests by analyzing the full URL against your URL data set (containing URLs you want to block) and determining whether to allow or block access to the URL. The URL filter API is highly performant and supports filtering millions of URLs, which wouldn’t be practical by simply loading a list of disallowed URLs into memory.
Network Extension URL Filter examines all URL requests sent via WebKit and the URLSession API. You create and manage a URL filter by using the NEURLFilterManager API and implementing the NEURLFilterControlProvider protocol in your app extension to fetch a Bloom filter onto the device. Network Extension performs URL filtering on your behalf with your URL data set, using both the Bloom filter on the device as well as an off-device database hosted on your Private Information Retrieval (PIR) server. The system first consults the Bloom filter to allow URLs that it can quickly determine aren’t in the filter list, then performs off-device database lookups with your PIR server if necessary. With this appoach, Network Extension URL Filter provides a performant yet privacy-preserving solution for both consumer and managed deployments.
For an example of writing and configuring a URL filter extension, see the Filtering traffic by URL sample code project.
For browsers or any app that doesn’t use WebKit or URLSession, use the NEURLFilter Participation API to voluntarily check URLs. Call the verdict(for:) method to check all URL requests and honor the returned verdict by failing the URL requests for blocked URLs.