- go
- redirection
- announcements
I recently focused on bringing a “URL shortening” service in-house. While I don’t frequently use URL shorteners, they come in handy for sharing things like NextCloud links or article URLs with friends and family. Having my own system avoids tracking and allows me to control the lifespan of the URLs.
Previously, I used Netlify for this purpose, which conveniently manages redirects through a single config file (Netlify Redirects Documentation). This setup was efficient: I simply updated a Git repository linked to a Netlify site. Adding a new redirect was as easy as committing and pushing changes, or editing the file directly in the web IDE.
To achieve similar functionality on my own server, I developed go-redirector. My prior experience with Go, building a personal API for various tasks (similar to IFTTT, but self-coded), assured me it was a suitable choice.
Go-redirector is straightforward. It stores redirects in the same format as Netlify and, upon startup, the server reads this file, registering each line as a separate route. It’s a lean solution, with an image size of around 15MB, focused solely on redirecting from a path to a URL.
For more details on its usage, you can check the repository.