0

How can I automatically redirect visitors of my website to its onion version if I detect that they're Tor users?

  • It's technically impossible: there're no way of identifying "incoming user connection channel" – Alexey Vesnin Jan 20 '17 at 18:58
1

With 100% accuracy? You can't.

You can use tools like TorDNSEL and lookup each incoming user through a DNS query to discover if they're using a known Tor exit.

Alternatively you can use the TorBulkExitList to export the current set of relays that allow exiting to your service. This list will get stale though.

There are always being to be edge cases where an IP is no longer in use as a Tor exit but it is on the list and you would redirect them to the .onion and they wouldn't connect. Similarly there will be Tor users whose IP isn't on the list that you don't redirect.

Some other approaches, which are more accurate, would be to test in the browser itself if they can connect to .onion addresses. Putting a tag like <script src='http://foo.onion'> and having the loaded script redirect users to the .onion website would let you redirect users who could fetch resources from the .onion but not those who couldn't.

Some Tor users choose to disable javascript entirely, in those cases you could take a similar approach but instead of javascript embed a CSS stylesheet that is loaded from the .onion site. If it is loaded, it could render a fullscreen overlay with a link for the user to click to take them to the .onion website.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.