Serve a website directly out of DNS

$ORIGIN    example.com.

@          CNAME serv.from.zone.
serv       TXT   "body>h1{Hello, World!}"

https://en.wikipedia.org/wiki/Zone_file

View it in action.

Extras

CSS
serv TXT "css=https://example.com/css/file.min.css"`
serv TXT "css=https://example.com/yet/another/css/file.min.css"`
Scripts
serv TXT "script=https://example.com/js/file.min.js"
serv TXT "script=https://example.com/yet/another/js/file.min.css"
Google Analytics
serv TXT "ga=UA-12345678-1"
Title
serv TXT "title=Hello World!"
Favicon
serv TXT "favicon=https://example.com/favicon.ico"
Meta Theme
serv TXT "theme=ababab"
Keywords
serv TXT "keywords=keyword1, keywords2"
Description
serv TXT "description=Description of the site"

But... why?

  • It's kinda neat.
  • It's free hosting.
  • No signup, login, or personal data required.
  • You can get a simple website running from the comfort of your domain registrar's admin panel.
  • Reduce the need for dedicated machines by serving many sites from 1 generalized server.
  • Attaching domain specific content to the zone makes sense in some cases (RFC), since the data is decoupled from a specific [web] server. In this case, a string which represents HTML.

Mostly this is a fun little gimmick. The theory is pretty interesting though. Maybe browsers could short-circuit DNS queries/responses by rendering what's in a special DNS record (SERV record perhaps?), skipping an additional web server query and all the latency that causes. Theoretically, something like this might halve the time it takes to render a site. It's a fun idea to entertain.

Naturally people might question the reliability of serv.from.zone as a web host. This project is open source, so feel free to serve it yourself.