Geonode logo
Website blocks

How to Fix a 451 Unavailable For Legal Reasons Error

Find out who withheld the page and why, what to send them, and how sites should return 451.

Updated

TL;DR

451 Unavailable For Legal Reasons means the website, or a provider in between such as your ISP, refuses to serve the page to comply with a legal obligation. Read the explanation in the response, then contact whoever sent it if you think the block is a mistake.

What a 451 looks like

A site's own 451 page usually explains the demand; clients without a page show only the code.

WhereWhat you see
curl -i (status line and Link header)HTTP/1.1 451 Unavailable For Legal Reasons / Link: <https://blocker.example/>; rel="blocked-by"
curl --failcurl: (22) The requested URL returned error: 451
Python urlliburllib.error.HTTPError: HTTP Error 451: Unavailable For Legal Reasons
curl 8.7.1, a proxy on the path answered CONNECT with 451curl: (56) CONNECT tunnel failed, response 451
Python urllib, a proxy answered CONNECT with 451urllib.error.URLError: <urlopen error Tunnel connection failed: 451 Unavailable For Legal Reasons>

Why this happens

A court order, law or takedown notice obliged the sender to hold this page back.

RFC 7725 notes that the sender need not be the site, so a 451 can come from the site itself, a cache provider or your ISP.

Diagnose your 451 first

The first two checks work in any browser; the other three read the response itself.

  • Read the 451 page itself; if it names a court, statute or rights holder, the block rests on that demand, not on anything you did.

  • Pause any VPN or proxy and reload once; if the 451 stays, the block applies to your own connection, not just that hop.

  • Print the response headers; the URI marked rel="blocked-by" points to whoever enforces the block, such as your ISP.

  • Check the Server header; server: cloudflare alone does not mean Cloudflare chose the block, since it may pass the site's 451 through.

  • Run curl -v via your proxy; a 451 answering CONNECT came from a proxy on the path, one after the tunnel from the site.

Solutions ranked by effectiveness

The first fix is for people in a browser, the second for scripts, the third for sites that send 451.

  1. Most common fix

    Ask whoever withheld the page

    Applies when you think the block is wrong or covers you by mistake; the sender can check whether its rule really applies to you.

    1. Write to the contact on the 451 page or at its blocked-by address.

    2. Include the full URL, the time and the reason text you saw.

  2. For developers

    Log the reason and skip the URL

    A 451 is not a transient error, so a script should save the reason and the blocked-by link, then move on without retrying.

    import urllib.error, urllib.request
    
    URL = "https://example.com/page"
    try:
        with urllib.request.urlopen(URL, timeout=30) as r:
            print(r.status, "page served")
    except urllib.error.HTTPError as e:
        if e.code != 451:
            raise
        print("451: withheld for a legal reason, skipping this URL")
        print("blocked-by:", e.headers.get("Link", "not sent"))
        print(e.read(500).decode("utf-8", "replace"))
  3. Site owners

    Send 451 the way RFC 7725 describes

    If you must withhold a page, the response should tell visitors why and who is blocking it, so they know whom to ask.

    1. In the body, state the demand's source, the law behind it and whom it affects.

    2. Point a blocked-by Link at your own organization, so visitors see who enforces it.

    3. Link a contact or appeal page so visitors know where to object.

Stop the 451 from coming back

One habit for scripts, then three for site owners who must withhold pages in some places.

  1. Leave 451 out of your retry rules; curl's --retry already treats only codes like 429 and 503 as transient.

  2. Send Cache-Control: private with any country-specific 451, since 451s are cacheable by default and shared caches could reuse them.

  3. Purge cached 451s from your CDN as soon as a legal demand ends, so visitors get the page back.

  4. Googlebot crawls from US addresses by default, and Google drops URLs answering 4xx, so a US 451 deindexes the page.

See your 451 as visitors doFetch your takedown pages through a residential IP and check the notice visitors receive.
Try residential proxies

Related errors

Learn more

FAQ

It means the server will not serve the page because a legal demand requires it to deny access. The code comes from RFC 7725, published in 2016.

You cannot clear it from your side; only the sender, or the party behind the legal demand, can withdraw it. Ask the sender first, quoting the reason it gave.

A 451 seen through a proxy is either the proxy's own refusal or the site's, passed back to you. Geonode's published list of the status codes its gateway returns does not include 451.

The number refers to Ray Bradbury's novel Fahrenheit 451, and RFC 7725 thanks Bradbury in its acknowledgements.

A 451 names a legal demand as its reason, while a 403 is a refusal that need not give one. Country blocks sent as 403 or Cloudflare error 1020, and bans on your IP address, have their own pages.

Not necessarily. RFC 7725 says the code implies neither that the resource exists nor that it does not, so the page may still fail once the legal demand is lifted.

Check where your site sends 451

Site owners: load your own pages from each market you restrict and confirm the 451.