Preventing YouTube Tracking Links on ActivityPub Servers
고남현 @gnh1201@hackers.pub
Preventing YouTube Tracking Links on ActivityPub Servers
YouTube links shared on ActivityPub servers are often mentioned as privacy concerns among users. This is due to various technical mechanisms that can be used to track visitors, such as the si parameter included in shared URLs, or various tracking technologies embedded in the YouTube website itself.
Realistically, projects implementing the ActivityPub protocol are unlikely to offer built-in solutions to this issue, as it's not specific to YouTube but part of the broader web tracking problem.
Nevertheless, server administrators can take practical measures at the server level to mitigate these concerns.
1. Use Alternative YouTube Frontends
Instead of connecting directly to YouTube, you can encourage the use of more privacy-friendly alternative frontends:
These frontends help reduce or eliminate tracking while maintaining video accessibility.
2. Rewrite Links Using Nginx sub_filter
After setting up an alternative frontend, you can use Nginx's sub_filter feature to transparently rewrite YouTube links. This prevents users from directly accessing the original YouTube URLs and instead directs them to view videos through the alternative frontend.
Here's an example configuration:
sub_filter 'www.youtube.com/' 'dnt-yt.catswords.net/';
sub_filter 'youtube.com/' 'dnt-yt.catswords.net/';
sub_filter 'www.youtu.be/' 'dnt-yt.catswords.net/';
sub_filter 'youtu.be/' 'dnt-yt.catswords.net/';
Results
Your setup is complete when you confirm that links to youtube.com or youtu.be are consistently changed to the alternative frontend address.
You can see a real-world application of this approach at the link below: