In this post I want to share a simple solution for the simple problem I wanted to solve some time ago. The problem definition is following:

I have a top level domain and a VPS operating on it. I also have a blog you are reading now hosted with Gitlab Pages. I want to host a website from my top level domain.

Hosting pages using Gitlab pages (similarly to Github Pages) is very convenient to set up, you just set up a pipeline and a subdomain configure the subdomain.

It get’s difficult assuming I want to keep my VPS with my top level domain.

There are few ways to achieve that. Assuming I want to keep the deployment process simple, preferably uniform with the blog, the simplest way to go would be a reverse proxy setup.

I’ve considered a few implementation options including things like nginx, but looking to learn something new and perhaps simpler than the options I already knew, I’ve found Caddy. Quoting it’s homepage

Caddy 2 is a powerful, enterprise-ready, open source web server with automatic HTTPS written in Go

Setting up a basic reverse proxy with Caddy is as simple as running

$ caddy reverse-proxy --from --to localhost:9000

If you are looking for a bit more advanced setup, you can set it up with Caddyfile. It’s a very simple, boilerplate free format. Additionally Caddy automatically acquires SSL certificates using Let’s Encrypt.

Building my reverse proxy from to was as simple as this: {
  # Run reverse proxy
  reverse_proxy {
    header_up Host {http.reverse_proxy.upstream.hostport}
  # Enable compression
  encode zstd gzip

Now wanting to set up my mastodon alias was as simple as this: {
  header Content-type application/json
  respond /.well-known/webfinger 200 {
    body `{
      "subject": "",
      "aliases": [
      "links": [
          "rel": "",
          "type": "text/html",
          "href": ""
          "rel": "self",
          "type": "application/activity+json",
          "href": ""
          "rel": "",
          "template": "{uri}"

Next time you need to set up a HTTP server, you might want to consider Caddy.