lobsters score: 4 · tags: web
I do a simpler variant of this that works using some lovely accidents in Apache httpd’s content negotiation and (like the linked article) Gemini.
https://alex.corcoles.net/notes/tech/how-this-site-works describes and demonstrates the trick.
The key is here:
Interestingly, when the request does not have an Accept header that selects a unique file, Apache replies with the smallest file, which frequently is the gemtext version. When using curl in a terminal, Apache replies with the gemtext version, which is nicer to read on a terminal.
MultiViewsis a wonderful feature. It’s a real shame that services that host static sites do not seem to configure this. It also enables “proper nice URLs”.Many sites use URLs such as
https://example.com/my-article/with a trailing slash, notably WordPress. This makes turning sites static quite annoying- you should create a directory per article and stick anindex.htmlin each directory. If you use MultiViews, then you can just havemy-article.htmland usehttps://example.com/my-articlewithout the trailing slash, which is much more convenient.(This also enables my main trick above- making a site that works across different formats and protocols much more easily.)
I should run a static site hosting service that enables this trick and that allows dual Gemini+gemtext/HTTP+HTML sites. SourceHut pages is really close to this :(
score 1 · canonical
You could also have
.htmlextensions everywhere, but that would not work well for sites with other formats, like my dual Gemini site.
score 1 · canonical
I’ve skipped the show.
curl tinthe.devis HTML, don’t see why to mess with the default. Seems like a super rare use-case. Are there people who curl sites?Although, I did put in
<link rel="alternate" type="text/markdown" href="/home.md" title="...">as a hint for usingAccept: text/markdownon the same URL. Or going to .md versions of pages. Did it a “sprint” of optimizing for other devices, screen readers, and LLMs. It is supported on the full page, posts included. Same point as the draft preview, less color.Not sure if the
X-Originalheader is the bit to use though. How many users will be comfy with cURL and headers, while not being comfortable using something likeAccept: text/html(which is the defacto standard). Poking at the implementation, seems like you ignore Accept headers entirely.Now I’m tempted to drop an invisible “instructions” block on top of curl, instructing for this alternate approach. But we’re approaching diminishing returns there, hah.
score 1 · canonical
Are there people who curl sites?
I curl sites by hand not that rarely, but generally to check at which stage things break for my curl → html-to-text pipeline. (I read a lot of stuff in Vim after having saved them to my drive)
If anURL marks itself text/plain via headers, then it gets to skip the html2txt part, of course.
score 1 · canonical
Are there people who curl sites?
I’ve only memorized one,
curl wttr.ingives a weather forecast in colored ASCII drawings. Unsure why it stuck with me…A similar thing was showing a starwars movie in ASCII over telnet, probably a very long time ago.
score 2 · canonical
A similar thing was showing a starwars movie in ASCII over telnet, probably a very long time ago.
Yes, good old
towel.blinkenlights.nl.nc towel.blinkenlights.nl 23 # or, if you still have it and want to learn how to *quit* it: telnet towel.blinkenlights.nl
score 1 · canonical
curl tinthe.devjust gives you301 Moved Permanently, but slapping on a schema does resolve it.
score 1 · canonical
curl defaults to http:// before the server even sees the request, so that 301 is the HTTPS push. I’d be curious if you’ve found a way around it.
score 2 · canonical
Not sure, and when I check my own website using curl it’s actually even worse at it doesn’t even give me a redirect output. I’ll have to give it a think.
score 2 · canonical
curl tinthe.devis HTML, don’t see why to mess with the default.Fun, presumably.
score 1 · canonical
Well, there was a tiny bit more in my comment, let me follow it up:
Are there people who curl sites?
I was wondering whether people do actually do do that for fun. First I’ve heard of it is the author and their inspirations. I’m genuinely curious.
score 1 · canonical
Nice idea. The two other referenced sites mentioned in the post returns HTML when queried by Curl.
score 1 · canonical
Finally, the last step is actually presenting the Curl version of your site to any user agent containing curl, which for me was just a few changes to my Nginx config, with other servers it’d presumably be equivalently simple. The main feature I wanted was an override header (X-Original: true) so you could still get an unmodified HTTP response like someone casually running Curl likely wanted, and I wanted everything to be served statically still.
Isn’t this what the
Accept-header is meant for? I.e.curl nytpu.com/gemlog/2026-03-18 -H "Accept: text/html".
score 1 · canonical
And given there are non-browser non-curl fetchers, one can also look where
text/x-ansiis relative totext/html
score 2 · canonical
One hiccup with this is that, if someone really did use
curlto browse the Internet, they probably havecurlpiped to something that expects HTML, e.g.readability --text | less. But if you serve text with ANSI tocurl, then it won’t parse as HTML and the page shows up as unreadable. Like LSP, the MxN problem of user agents and websites is usually solved by having one common format, HTML, and having each user agent adapt HTML to its idiom.
score 1 · canonical

