mshibanami / redirect-web

Repository of the support website for Redirect Web for Safari
https://mshibanami.github.io/redirect-web/
MIT License
32 stars 2 forks source link

Redirect to a custom search engine without Safari default ones #48

Open nyakojiru opened 3 months ago

nyakojiru commented 3 months ago

How to redirect to a custom search engine Like SearXNG , without using one of the default search engines available in Safari? I don’t want to log my searches in any of them, it’s one of the main purpose I bought the app (privacy). Thank you.

mshibanami commented 3 months ago

@nyakojiru You can use the new DNR type to achieve your goal. This type doesn't initiate a request of fetching source web pages, as it uses the DNR API, which is specially tailored for privacy by W3C.

For example, suppose you wish to use search.rhscz.eu, one of the SearXNG instances, as your default search engine. Follow these steps:

  1. Set the default search engine to DuckDuckGo in the Settings app > Safari > Search Engine
  2. Create the following redirect rule:
    • Type: DNR
    • Redirect From:
      • https://duckduckgo.com/\?(?:.*&)?q=([^&]*).* (Regular Expression)
      • Resource Types: main_frame
    • Redirect To: https://search.rhscz.eu/search?q=$1

I confirmed it didn't trigger a search query of DuckDuckGo, using Charles Proxy:

https://github.com/user-attachments/assets/fe980ff5-5c92-4569-8afc-c7b2935312b1

(bag.itunes.apple.com is an unrelated system request. Please ignore it.)

Optionally, you can disable Search Engine Suggestions from the Settings app > Safari so Safari won't even try to request search suggestions. Otherwise, it'll still call them like this:

https://github.com/user-attachments/assets/9521b4e6-f463-42aa-a231-3bc9ea145151

By the way, this is actually a great use case for user privacy that I didn't realize until now. I'll probably push this use case to other users too. Thanks a lot!

mshibanami commented 3 months ago

I'm closing this issue now. Please feel free to reopen it or create another issue if you have any othrer questions. You can also ask in https://github.com/mshibanami/redirect-web/discussions. Thanks.

nyakojiru commented 2 months ago

Hey, thank you for your detailed response! really appreciate it 😄 I tried it on iOS and it worked! But tried the same on macOS and is not redirecting. Not sure why. If I do a query from the address bar, it goes directly to duckduckgo

mshibanami commented 2 months ago

@nyakojiru Oh, that's strange. I double-checked it on my end but couldn't replicate it:

https://github.com/user-attachments/assets/bbac6321-164e-4338-a1b4-7b226a3b72e7

Could you please record a video showing what's happening on your side? Specifically, I'd like to see the following:

I hope this helps.


HOWEVER, I noticed that it no longer works on Safari Technology Preview 202. Safari doesn't load any web page when entering a query:

https://github.com/user-attachments/assets/52c6f6d4-bd21-49d8-b82b-cf38689b3cb2

I confirmed this issue also occurs on iOS 18.0 RC (22A3354) on my device.

It seems to have regressed, or perhaps it was intentional? I doubt it since it ruins the UX but it could be possible because they restrict the default search engines. I'll ask about this on Apple's developer forum first.

mshibanami commented 2 months ago

Replication:

mshibanami commented 2 months ago

Posted: https://developer.apple.com/forums/thread/763505

nyakojiru commented 2 months ago

Sorry for the late response. I can confirm, it stopped working both in iOS and macOS . Tried in iOS version 18 and 16.7.7 Tried in macOS Ventura 13.7 image

mshibanami commented 2 months ago

Thanks for the information. As you can see, my post on the forums hasn't received any response from Apple yet. However, I believe they have already recognized the issue. Let's wait and see how it goes...

nyakojiru commented 1 month ago

Seems they recognized it, but who knows when they will take actions. I don't know how their dev community works when an issue apears. Do you think there can be a temporal workaround? I will really appreciate it :)

mshibanami commented 1 month ago

No, I don’t think so if the DNR is a requirement for you. The control a third party has with DNR is extremely limited. (That makes DNR privacy oriented.)

You should either use the Original type or downgrade Safari.