Yoooo, it's actually that easy? This is the shortest HTTP server config I've ever had to type, unless you count `python3 -m http.server` or something. That's insane.

#openbsd

One of the arcs of my software opinions over the last 5 years, and really the last 8 months especially, is how necessary brevity is for correctness, maintainability, and security (which are really three sides of the same thing). I might have only graduated that from hunch to conviction recently, but it looks like the OpenBSD people have been on it for awhile here, and that's incredibly reassuring and validating for me, as I'm taking my first steps evaluating a move to OpenBSD for my web hosting needs.
Even configuring the Markdown content type (something necessary for some of my particular website quirks) is concise. This is ridiculous. I'm in love. Don't look at the nginx.conf I'm currently using in production.
@MaddieM4 What do you use the markdown mime time for, exactly? I'm genuinely curious!

@spacehobo Okay, the response type isn't the most critical thing, but the important bit is what I have to figure out how to express in httpd.conf next: being able to request any page on my website with the `Accept: text/markdown` HTTP header, and get the original markdown source used to generate the page.

This is fun in its own right, and I use it on the regular from the command line, but it's also something that an extremely silly program I made awhile back depends on. `glu` fetches a page, finds all the blocks of source code in that page, creates a temporary directory, and populates it with those source files, running a command in the directory which defaults to `bash`. For trustworthy websites, it's a quick and dirty "here's the files, try it for yourself" tool. It's currently just smart enough to understand Markdown code blocks that have language tags, like

```python
# hello.py
print("Hello world!")
```

We need the comments to discern the filename, so we need the language to discern comment syntax.

@MaddieM4 That's super neat!

@spacehobo Right? You can even see a demo on my homepage.

Technically, it _prefers_ to deliver markdown, which is why those example commands work with no `-H` headers. It delivers HTML if there's an Accept header AND the header contains "text/html" in there somewhere, which every single graphical browser sends (usually as part of a very expansive list of options).

All my site pages are written in Markdown with some amount of frontmatter at the top. That frontmatter can optionally contain a list of `glu` commands. If, and only if, that option is present, do I render out a widget at the top of the page, where people can conveniently copy an appropriate `glu` command to their clipboard. Notice that the homepage has exactly one: `bash hello.sh`, which references a snippet of shell code in the middle of the document.

https://maddiem4.cc/

@MaddieM4 I'm impressed that even lynx seems to get the HTML version from you, while curl shows me the markdown. Food for thought!

@spacehobo Right? It's not some practical important thing, but it's fun.

I actually made this on-stream as an exercise for learning Rust, back when I was streaming on Twitch during my last gap in employment. In fact, I made my website as a rocket.rs app, though I eventually later converted it to be a static site generator. I learned a lot of practical things during those sessions, but ultimately the most practical was "I strongly prefer not to program in Rust."

Very little of my stream content is preserved, and mostly on YouTube, but I'm slowly migrating it to MakerTube, where my reuploads are kinda woven in between new content. I don't stream anymore, but I make short silly things, and also recently an hour-long video of how I downloaded and starting hosting all of English Wikipedia locally on my laptop as a form of civil protest.

@MaddieM4 Caddy is similarly shocking for its simplicity. It's a good trend.

@MaddieM4

Even easier for those who have learned the modern BSD ftp command. (-:

The BSDs decided that since the tool for fetching files was named ftp, they'd just augment the protocols that it was capable of speaking.

#FreeBSD has an extra fetch command as well. But all of them β€” #NetBSD, #OpenBSD, and the derivatives of those three β€” have ftp commands that speak HTTP, originating in a lukemftp (later tnftp) project by Luke Mewburn for NetBSD in the 1990s.

It's also in #Debian.

#ftp #fetch

@JdeBP wow! That's neat, but not something I would have guessed, nor something I would have organically discovered quickly. Thank you!

@MaddieM4 I use the python http.server all the time for stuff, it’s so convenient and simple. Python docs claim it has security considerations, but they are not issues for me. Also while looking to see if their security warning was still there just now, I notice that Python 3.14 added TLS support to http.server, which is one of the reasons I usually put these behind nginx to terminate TLS.

https://docs.python.org/3/library/http.server.html#http-server-security

http.server β€” HTTP servers

Source code: Lib/http/server.py This module defines classes for implementing HTTP servers. Availability: not WASI. This module does not work or is not available on WebAssembly. See WebAssembly plat...

Python documentation
@wesley Yeah. I don't even do hosting *that* real, it's just temporary proof of concept type things, so it's always been a perfect tool for appropriate jobs :D