Why You Should Block Tor Access

Posted on

Blocking access to the Tor network for your website can be a controversial decision, and it’s essential to weigh the pros and cons before implementing such a measure. Some reasons for blocking Tor might include concerns about security, abuse prevention, and compliance with local laws or regulations.

Firstly, security can be a significant concern for website administrators. The Tor network allows users to browse the internet anonymously, which can attract malicious actors looking to exploit vulnerabilities or engage in illicit activities. By blocking Tor, you might reduce the risk of attacks like DDoS, brute force attacks, or fraudulent activities that could harm your website or its users.

Secondly, abuse prevention is another consideration. The anonymity provided by Tor can make it challenging to identify and block users who engage in abusive behavior, such as spamming, trolling, or distributing illegal content. Blocking Tor might make it easier to manage and moderate user activity, ensuring a safer and more enjoyable experience for legitimate users of your website.

Lastly, compliance with local laws or regulations may require you to block Tor access. Some countries have restrictions or bans on the use of Tor due to concerns about national security, censorship, or illegal activities. If your website operates in one of these regions, blocking Tor might be necessary to avoid legal complications or penalties.

However, it’s essential to recognize that blocking Tor can also have drawbacks. By restricting access to the Tor network, you might alienate legitimate users who rely on Tor for privacy reasons, such as journalists, activists, or individuals living in countries with oppressive regimes. Additionally, blocking Tor could give the impression that your website is not privacy-friendly, which might deter users concerned about their online privacy and security.

How to block Tor access via htaccess
Blocking Tor access to your website using .htaccess is a technique that involves denying requests from IP addresses known to be part of the Tor network. Here's a step-by-step guide on how to set this up:

Step 1: Obtain a List of Tor Exit Node IPs

First, you need a current list of Tor exit node IP addresses. These lists are dynamically updated and can be obtained from various sources online, such as the Tor Project’s official site or third-party providers who maintain lists specifically formatted for use in .htaccess files.

Step 2: Update Your .htaccess File

Once you have your list of Tor exit node IPs, you'll need to add rules to your .htaccess file to block them. The .htaccess file is located in the root directory of your website. If it’s not there, you can create it.

Here’s how you might structure the rules in your .htaccess file:

<Limit GET POST>
order allow,deny
# List the IPs from the Tor exit nodes here
deny from
deny from
# Continue listing IPs
allow from all

Replace,, etc., with the actual IP addresses of Tor exit nodes.

Step 3: Continuous Updates

Because the list of Tor exit nodes changes frequently, you will need to regularly update your .htaccess file to include new IPs and remove old ones that are no longer part of the Tor network. This can be automated with a script that pulls updated lists and modifies the .htaccess file accordingly, or it can be done manually if preferred.

Step 4: Test Your Configuration

After updating your .htaccess file, it’s important to test your website to ensure that it is still accessible to regular traffic but blocks identified Tor traffic. Testing can be done by attempting to access your site through the Tor browser and observing if access is denied.


  • Performance: Constantly updating a large list of IP addresses in your .htaccess file can potentially slow down the response time of your server because each request needs to be checked against a long list of denied IPs.
  • False Positives/Negatives: Some legitimate users might be using Tor for privacy and not malicious intent, blocking them could deny access to your site undesirably.
  • Maintenance: Keeping the IP list updated requires continuous attention or automation.

Using .htaccess to block Tor can be an effective way to enhance your website’s security, but it should be part of a broader security strategy that considers both the benefits and limitations of such an approach.

How to block Tor network country via Cloudflare
You can block traffic from the Tor network via Cloudflare by using the Cloudflare Firewall Rules. Cloudflare allows you to create custom firewall rules based on various criteria, including the country of the request origin.

Here's how you can create a Cloudflare Firewall Rule to block Tor traffic by country:

  1. Log in to Cloudflare Dashboard: Log in to your Cloudflare account and select the domain for which you want to create the Firewall Rule.

  2. Go to Firewall: Navigate to the Firewall section in the Cloudflare dashboard.

  3. Create a Firewall Rule:

    • Click on the "Create a Firewall Rule" button.
    • Give your rule a name, like "Block Tor Traffic".
    • Under the "Field" dropdown, select "IP Geolocation".
    • Under the "Operator" dropdown, select "is in".
    • In the "Value" field, enter "Tor" or select the appropriate country code(s) for the Tor network (commonly associated with the United States, but this might vary).
  4. Action:

    • For the action, select "Block".
  5. Apply the Rule:

    • Once you've configured the rule, click on "Deploy" or "Save and Deploy" to activate the rule.

This rule will block traffic originating from the Tor network or the specified country/countries from accessing your website through Cloudflare.

Websites might block Tor traffic due to reasons like, including security concerns, as Tor can be used to obscure the identity of individuals engaging in malicious activities, making it difficult to enforce bans or blocks against abusers. Additionally, some users utilize Tor to circumvent restrictions or terms of service, prompting websites to block Tor to prevent abuse and manage traffic more effectively. Moreover, certain legal or regulatory requirements might compel websites to restrict Tor access to comply with local laws, ensuring that they do not inadvertently facilitate access to prohibited content or services. If you think it's appropriate for your needs, these methods can be employed to enhance security and manage website traffic more efficiently.