Introduction
Fabio is a fast, zero-configuration HTTP and TCP load balancer written in Go. It integrates natively with HashiCorp Consul for service discovery and automatically builds its routing table from Consul service tags, eliminating the need for manual configuration files or reloads.
What Fabio Does
- Routes HTTP and TCP traffic to backends registered in Consul
- Builds and updates routing tables automatically from Consul service tags
- Supports path-based, host-based, and weighted routing rules
- Terminates TLS with automatic certificate management via Consul or Vault
- Provides a real-time web UI showing the current routing table
Architecture Overview
Fabio watches the Consul service catalog for changes and rebuilds its routing table whenever services register or deregister. Each service announces its routes through Consul tags using a simple urlprefix- convention. Incoming requests are matched against the routing table and proxied to healthy backends. Health checks are delegated to Consul, keeping Fabio stateless and simple.
Self-Hosting & Configuration
- Download a single binary or install via go install
- Ensure Consul is running and accessible on the default address
- Register services with urlprefix- tags to define routing rules
- Configure TLS termination by pointing to certificate sources in Consul KV or Vault
- Customize behavior through environment variables or a properties file
Key Features
- True zero-configuration setup when paired with Consul
- Automatic routing table updates with no restarts or reloads
- Path-based and host-based routing with glob pattern support
- Built-in web UI for monitoring active routes and traffic metrics
- Single static binary with no external dependencies beyond Consul
Comparison with Similar Tools
- Traefik — supports many service discovery backends; Fabio is purpose-built for Consul with simpler configuration
- HAProxy — requires config file updates and reloads; Fabio updates routes dynamically from Consul
- Nginx — general-purpose web server requiring config management; Fabio is a focused load balancer
- Envoy — feature-rich L7 proxy with complex config; Fabio trades features for zero-config simplicity
FAQ
Q: Does Fabio require a configuration file? A: No. Fabio reads all routing information from Consul service tags. Optional settings can be passed via environment variables or a properties file.
Q: How are routes defined? A: Services register in Consul with tags like urlprefix-/api or urlprefix-mysite.com/. Fabio watches for these tags and routes traffic accordingly.
Q: Does it support WebSocket connections? A: Yes, Fabio supports WebSocket proxying for services registered with appropriate route tags.
Q: Can I use Fabio without Consul? A: Consul is the primary service discovery backend. For environments without Consul, static routes can be configured, but dynamic discovery requires Consul.