Goeie

June 27, 2025

Rust

Dutch for ‘good one’ (good luck pronouncing that)


When owning a domain, you often want to redirect a request to a different destination. For example, routing a request to www.example.com to example.com. Depending on the server you’re using, you can simply use a CNAME record for this, but sometimes you cannot.


Usually, I have to write some custom behavior in my backend to redirect the request, or configure a reverse proxy like Traefik correctly (which is a bit more involved). So to solve this (and because I had nothing better to do), I started writing a simple service with Rust to handle this for me.


Some things that I wanted to have:

  • Simple configuration
  • One instance for multiple domains
  • Support for CNAME records

Configuration

To configure Goeie, I choose a simple TOML configuration file. Here’s an example:

[[redirect]]
hosts = ["www.boris.foo"]    # All hosts that redirect to this target
target = "https://boris.foo" # Where to redirect to
redirect_type = "Temporary"  # Optional; 'Temporary' or 'Permanent', defaults to 'Temporary'

# You can create as many redirects as you want!

[[redirect]]
hosts = ["www.example.com"]
target = "https://example.com"

The configuration file is cached for 5 minutes, so you can change it without restarting the service. To use the service, you can point a CNAME record to the IP address of the Goeie server.

www.example.com CNAME example.com

To see it in action, you can visit www.boris.foo and it will redirect to boris.foo. If you would like to view the source code, you can find it here.

Copyright © 2016-2025 boris.foo (formerly borisnl.nl), All rights reserved.