If you work in government and are asked to remove content from websites (as a result of executive orders), please use the HTTP status code 451 instead of 404.

451 is the correct status code to use for these cases, and you'll be doing the rest of the country a service by using it.

Addendum: you should also include a Link header with the link relation "blocked-by" that "Identifies the entity that blocks access to a resource following receipt of a legal demand."

https://www.rfc-editor.org/rfc/rfc7725.html

RFC 7725: An HTTP Status Code to Report Legal Obstacles

I just noticed the Monty Python joke @timbray managed to include in that RFC. 🀣

Thank you, Tim!

@ramsey @timbray FWIW, I'll always think of @millert when this comes up: I once mixed up which of the *BSDs he was associated with, and he launched into a People's Front of Judea bit about it. It was excellent.
@wez @timbray @millert The example in the Link header even uses SPQR as part of the URL!

@ramsey @wez @timbray @millert And notice that SPQR (Senatus Populusque Romanus) means "The senate and people of Rome", not "some random Roman dude with a big ego". We need more SPQR and less Heliogabulus (one of the more "colorful" Roman emperors - colorful enough for his name to appear in the Major General's song in Gilbert and Sullivan's The Pirates of Penzance - "the crimes of Heliogabalus").

https://www.youtube.com/watch?v=Rs3dPaz9nAo
[The link points to the Major General's song with subtitles].

Major-General's Song from The Pirates of Penzance - live and with lyrics!

YouTube
@ramsey @timbray
That's hilarious. I wonder if the Judean Peoples' Front put him up to it.

@timjclevenger

Well, there it is -- one random word can make me laugh out loud!

@ramsey @timbray Yes, the Life of Brian is a good reference if any. And the acknowledgement to Ray Bradbury made this RFC complete πŸ‘
@ramsey @timbray thanks for the Bradbury shout out.
@ramsey Isn't there a book with that name in it?
@derickr Nah, you're thinking of Bay Radbury's "Centigrade 233." Common mistake.
@ramsey You had to look up that conversion, didn't you? πŸ˜„
@ramsey That's not a real book. I think you mean Kelvin 506.15.
@derickr @ramsey I mean, the spec includes a thank you to Ray Bradbury...

@ramsey wait but you mean anyone maintaining a website of a government agency?

Or do you mean people responsible for implementing govt-mandated blocking of 3rd party web content?

If the latter, I'd think the people who do that work for ISPs, not governments?

@wolf480pl As far as I know, ISPs have not been required to block access to this content, though that was the original intent of the status code. In this case, I'm referring to the former: "anyone maintaining a website of a government agency," since these pages and data sets are being removed in response to executive orders.
@wolf480pl In case it's not clear, I posted this in response to specific executive orders issued by the current US president.
@ramsey oooh, ok, I was missing that context
@ramsey or just don't remove it? 
@ch0ccyra1n That might not be an option if you need to keep your job / contract.
@ramsey

So... I can't get information due to a client-side problem? I get the literary reference, but 4xx indicate client configuration problems. Even if one's mingling SMTP codes' structure, 451 would imply a transient condition ...which feels unduly optimistic.

@ferricoxide RFC 7725 defines status code 451 as "Unavailable For Legal Reasons."

"This status code indicates that the server is denying access to the resource as a consequence of a legal demand."

In this case, pedantic arguments about the differences between 4xx and 5xx are moot, since there's an RFC that defines the status code. If I were making up this status code on the spot, I might agree with you. πŸ™‚

@ferricoxide But it is sort of like a 404, though. The client has requested a resource that the server cannot serve, which is a client problem, not a server problem.
@ferricoxide 410 Gone has a similar meaning: the client has requested a resource that no longer exists on the server, which is a client problem.
@ramsey This is really deep. You want access to forbidden knowledge, something is wrong with YOU
@ferricoxide
@ramsey (if protesting and not complying is not an option, of course. I don't know if I could if I were asked.)
@bencomp This is a somewhat subversive way of addressing the issue. You’ve complied, and you’ve used the technically correct status code, which most people will never see or recognize.

@ramsey reading these RFCs makes me realise how precious the internet is.

I yearn for a world where we can all be this professional and unhinged at the same time, connecting our worlds through hypertext and without JavaScript tracking popups. 

@ramsey it also reminds me of my postgrad seminar in semantic web and how I miss this world that never happened. 
@ramsey Okay, but http 451 is "unavailable for legal reasons." What's the code for "unavailable for illegal reasons"?

@ramsey
"Legal demand"
Ha!
"DO IT OR LOSE YOUR JOB!"

Or more like it it's one of Musk Muppets who's got the passwords.

@ramsey Ben - unless you tell me you've posted the same on bluesky I'll screenshot it and do it for you
@GrahamSkeats I’m not on Bluesky, so that’s fine. I don’t mind you sharing it there. Thanks!

@ramsey

HTTP status code 451:
Unavailable for Legal Reasons

HTTP status code 404:
Does not exist, has moved or is broken

@PostcardsFromParadise @ramsey "Has moved" should be 301 if you can give the new address or 410 if you cannot.
@ramsey which USA web sites are using 451 now?
451 Unavailable For Legal Reasons | HTTP Cats

HTTP Cat for status 451 Unavailable For Legal Reasons

@ramsey This is mostly unnecessary hairsplitting, but I think it could be argued that semantically 451 is the correct code when the content is not removed but is blocked for YOU but not necessarily for everybody else (using geolocation or something else). I think that's why it's a 4xx client error.

So, if the pages are made unavailable for everybody (in other words, removed), I would say 404 is the correct code. Do I actually care? Absolutely not xD

@jakeRaccoon @ramsey The RFC talks about legal reasons, not about for whome its not available.
And it is 451, because it is 451.

@jakeRaccoon
You could argue
410 Gone (if you are pessimistic)
or
503 Service Unavailable (optimistic)

Server errors are temporary.
@ramsey

@jakeRaccoon @ramsey I don't think that's correct. Although that's the example used in the RFC, the rest of the RFC uses language like "many" instead of "all," so I don't think they intended this to be a limitation.
@curtmack Oh, I don't think the RFC intends to limit or discourage using 451 in cases like this. But for me 404 still sounds more semantically correct when the content has actually been removed from the server and is unavailable to all users, even if the removal was due to legal reasons.
@jakeRaccoon I'm hairsplitting for subversive purposes, like when your administration forces you to take down scientific data sets and remove whole repositories of information because they don't like it.
@ramsey Do you mind if a screenshot of this finds its way onto Reddit?
@maj I don't mind, though I don't have a Reddit account, so if anyone there wants to discuss with me, they'll need to email me or find me here. πŸ™‚
@ramsey Just noting we're asking people to risk their jobs because a bunch of us were too fucking lazy to vote these bastards out. I hope they do it, but I hope we all do some soul searching to ask ourselves how we got here.
@lyda Right. I'm hoping that a 451 will go unnoticed by most and for those who do notice, one could make a pedantic argument to claim they weren't doing it out of a subversive intent.
@ramsey
Or you just create a client-side overlay and leave the backend as is.
@briankrebs
@j_j @briankrebs Or leave the backend as-is, while responding with a 451 and a client-side overlay?
@ramsey do we need a new status "unavailable for fascist reasons"?
@kkeller @ramsey HTTP 5(19)84 doesn't seem to allocated yet ...
@ramsey I got a 451 last week, the first time I'd ever seen one. I'm afraid I don't remember which site I was trying to access, other than I'm pretty sure it was a US one.