Dear Kagi team,
I have attached Apple source code taken from Adopting Declarative Content Blocking in Safari Web Extensions and modified it to demonstrate how to redirect searches from duckduckgo.com to kagi.com using the declarativeNetRequest API.
The file contains a git repo, so you can see the differences from the source code that Apple provides. Using this approach to redirects, I have been able to observe:
- 100% success rate with redirecting from duckduckgo.com to kagi.com
- No requests to duckduckgo.com are made, provided that "Search Engine Suggestions" is disabled in Safari settings so that there are no requests for auto complete.
Please note that to make this extension work, the user needs to set their session token in the code. Search for SESSION_TOKEN in the ruleset_1.json file.
You can test and observe that requests are redirected and not sent to the default search using Proxyman on iOS. I'd recommend setting up kagi.com and duckduckgo.com in the SSL proxy list so that you can see the full request/response body.
The Kagi extension for Safari does not work 100% and searches to the default search engine still go through, even when "Search Engine Suggestions" are disabled. To kagi users: If your goal is to avoid sending seaches to Google, then setting Google as your default and using the Kagi for Safari extension will still send all of your searches to Google. I consider this to be a large oversight from the Kagi team. Either they are unaware of it, or do not think it's important to tell Kagi users about this.
I'm sharing this example because I want to demonstrate that this kind of redirect that is both private and reliable is 100% possible. I've seen comments from the Kagi team that Apple restrictions make (1) and (2) impossible. Even within the Kagi extension it says:
Sorry that Apple made this so complicated. We even started building an entire WebKit browser called Orion to make it easier to use Kagi on Mac. We’d appreciate if you gave it a try.
These just sound like excuses, and it makes me lose confidence in the team.
If the team wants to roll out a quick fix, I'd suggest statically hardcoding all of the redirects in the declarative ruleset, and asking users to enable the extension to have permission on the domains they are using. For example, enable the extension to have permissions on duckduckgo.com and kagi.com. That's a more flexible setup for users than trying to match the kagi app settings to the safari settings.