Cloudflare error 1020: Access denied, and how to find the rule that caused it

Error 1020 means a Cloudflare firewall rule blocked your request. How owners find the rule in the security log, fix false positives, and what visitors can try.

· 6 min read · By the Spot Downtime team

Error 1020 "Access denied" is a Cloudflare page, not one from your website. It appears when a request matches a firewall rule set to block. The rule can belong to the site owner, to a Cloudflare managed rule set, or to a bot protection feature. Unlike the 52x family, this isn't a connection problem with the origin: the request never gets there.

If you're a visitor, scroll to the end. If you own the site, the fix is to find which rule fired, which Cloudflare logs for you.

What the error page tells you

The page shows "Error 1020 Access denied", the site's domain, a Ray ID, and your IP address. The Ray ID is the key. It identifies this one request in Cloudflare's logs, so a blocked user can send it to you and you can search for it.

Find the rule that blocked the request

  1. Ask the affected person for the Ray ID and their IP address (or take them from your own failed request).
  2. In the Cloudflare dashboard, open the domain and go to Security, then Events. The name varies a little between dashboard versions.
  3. Filter by Ray ID or by IP address, within the time of the block.
  4. Read the Service and Rule columns. They name the feature and the rule that acted: a custom rule, a rate limit, a managed rule, bot fight mode, or an IP access rule.

Once you know the rule, the right fix is usually obvious. Changing it for one false positive is far better than turning a whole protection off.

Common causes

A custom rule that is too broad

Rules that block by country, ASN, user agent or URL path catch more than intended. A rule such as "block if country is not US" blocks travellers, VPN users and any monitoring probe running outside the US. Check the rule's expression and narrow it, or add an exception for the paths and clients that must work.

text
# Too broad: blocks every request from outside the US
(ip.geoip.country ne "US")

# Narrower: block only the admin area
(ip.geoip.country ne "US" and starts_with(http.request.uri.path, "/wp-admin"))

An IP access rule or blocked ASN

Someone may have blocked an IP, a range or an ASN during an attack and never removed it. Dynamic IPs get reassigned, so the address that was abusive last month may belong to a legitimate visitor now. Review the IP access rules and remove stale ones.

A rate limiting rule

A rule that blocks clients exceeding some number of requests per period will trip on a busy API client, a shared office IP, or a script that retries aggressively. If the block is for a limited time, it clears by itself. For a legitimate client, raise the threshold or exempt the path. See 429 Too Many Requests for how clients should back off.

Managed rules and bot protection

Cloudflare's managed rule sets and bot features score requests, and unusual clients such as scripts, uptime probes and older browsers can score as suspicious. The event log shows which managed rule matched. You can skip a single rule for a path, or switch its action from block to log while you assess it.

A rule written for a different problem

Rules created for a WordPress login attack, a scraper or a bad referrer often outlive the incident. When something breaks for a small group of users, look at recently created or edited rules first.

Allow your own monitoring and integrations

Uptime checks, payment webhooks and mobile apps are not browsers, and they are the clients most often blocked by mistake. A monitor that reports 403 or shows the 1020 page while the site works for you has been blocked by a rule. Allow it by header or IP rather than loosening the rule for everyone. The firewall allowlist guide shows how to do this in Cloudflare and other firewalls, and Monitor says down but the site works covers diagnosing the same symptom.

1020 is not 403

The 1020 page is served with a 403 status code. If you monitor the URL, the check reports a 403, so open the response body to tell a Cloudflare block from your application's own 403 Forbidden.

Test from outside your network

Reproduce the block with curl and compare a browser-like request with a bare one:

bash
curl -i https://example.com/
curl -i -A "Mozilla/5.0" https://example.com/ | head -20

If the second request passes, a user agent rule is involved. The response header cf-ray gives you the Ray ID to look up.

Check a website from multiple locationsSee whether a block depends on where the request comes from, which points to a country or ASN rule.

If you are a visitor

  • Turn off your VPN or proxy and reload. Shared VPN IPs are the most common reason an ordinary visitor is blocked.
  • Try another network, such as mobile data, to see whether your IP is the problem.
  • Disable browser extensions that change headers or block scripts, then try again.
  • Contact the site owner and send the Ray ID and the time. Only they can change the rule. Clearing cookies or restarting the browser won't.

Catching blocks before customers do

A firewall rule can lock out a country, a customer or a payment provider without any outage in your server logs. Checks from several regions will show a region-specific block. Spot Downtime runs checks from three regions and confirms failures from all three before it alerts, so a regional block shows up in the check results while a single transient failure doesn't page you. Set an expected status of 200 on key URLs with a website monitor, and a change to a rule that returns 403 will be visible quickly.

Get new guides by email

Practical posts on monitoring, outages, error fixes and on-call, when they're published. No spam.

Unsubscribe from any email with one click. See our privacy policy.

Keep reading