Blocked for legal reasons.
When to use it
Content removed by court order or blocked in a country.
Common causes and fixes
451, a nod to Fahrenheit 451, means access is blocked for a legal reason: a court order, a government block, a copyright takedown, sanctions, or regional rules such as sites blocking EU visitors rather than complying with GDPR. GitHub returns it for repositories removed after a DMCA notice. The spec asks servers to name the blocking authority in a Link header with rel=blocked-by.
As a user, the block usually depends on your country or IP, so there is nothing to fix client-side. As a developer, prefer 451 over 403 or 404 for legally restricted content, so users, researchers and crawlers can tell censorship from a missing page, and explain the reason in the body. Search engines drop 451 URLs from results much like 404s.
Client error (4xx)
4xx codes are client errors: the request itself is wrong, unauthorised or points at something that isn’t there. Retrying the same request won’t help.
What it looks like
HTTP/1.1 451 Unavailable For Legal ReasonsHow to send it
| Node.js / Express | res.status(451).end() |
|---|---|
| Python / Flask | return '', 451 |
| nginx | return 451; |
How to check it
curl -s -o /dev/null -w "%{http_code}\n" https://example.com/