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.
| Where | What 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 --fail | curl: (22) The requested URL returned error: 451 |
| Python urllib | urllib.error.HTTPError: HTTP Error 451: Unavailable For Legal Reasons |
| curl 8.7.1, a proxy on the path answered CONNECT with 451 | curl: (56) CONNECT tunnel failed, response 451 |
| Python urllib, a proxy answered CONNECT with 451 | urllib.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.
- 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.
Write to the contact on the 451 page or at its blocked-by address.
Include the full URL, the time and the reason text you saw.
- 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")) - 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.
In the body, state the demand's source, the law behind it and whom it affects.
Point a blocked-by Link at your own organization, so visitors see who enforces it.
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.
Leave 451 out of your retry rules; curl's --retry already treats only codes like 429 and 503 as transient.
Send Cache-Control: private with any country-specific 451, since 451s are cacheable by default and shared caches could reuse them.
Purge cached 451s from your CDN as soon as a legal demand ends, so visitors get the page back.
Googlebot crawls from US addresses by default, and Google drops URLs answering 4xx, so a US 451 deindexes the page.
Related errors
Learn more
FAQ
Check where your site sends 451
Site owners: load your own pages from each market you restrict and confirm the 451.


