Routing Modes
Tun offers flexible routing options for accessing your local Craft CMS sites.
Localhost Mode
Port-based routing with no configuration needed. Each site gets a unique port:
localhost:8282
localhost:8283
localhost:8284
Pros:
- No configuration needed
- Works immediately out of the box
- No /etc/hosts or DNS setup required
- Perfect for quick testing
Cons:
- HTTPS is not available (HTTP only)
- Port numbers can be hard to remember
Hostname Mode
Custom domains with HTTPS support. Sites are accessible via *.tun.test domains:
mysite.tun.test
another-project.tun.test
client-site.tun.test
Pros:
- Clean, memorable URLs
- HTTPS support with automatic SSL/TLS certificate generation
- More realistic production-like environment
- Consistent domain naming across all sites
Cons:
- Requires /etc/hosts configuration (you need to add entries manually)
- May need to clear DNS cache on first use
Note: The reverse proxy (Traefik or Caddy) handles routing to sites on *.tun.test domains automatically, regardless of the underlying container backend.
Switching Routing Modes
You can change a site's routing mode at any time:
- Open the site in Tun
- Go to the "Overview" tab
- Click the routing mode dropdown
- Select your preferred mode
- Tun will automatically reconfigure the site
HTTPS Configuration
When using hostname mode, Tun automatically generates and manages SSL/TLS certificates through the reverse proxy. Your sites will be accessible via HTTPS without any additional configuration.
The reverse proxy handles SSL/TLS termination, providing:
- Automatic certificate generation
- Unified routing regardless of container backend
- Consistent domain naming across all sites
Note: HTTPS is not available when using localhost mode—only HTTP is supported.
Switching Between Modes
You can switch a site's routing mode at any time:
- Open the site in Tun
- Go to the "Overview" tab
- Click the routing mode dropdown
- Select your preferred mode (hostname or localhost)
- Tun will automatically reconfigure the site and restart containers if needed
When switching to hostname mode, you'll need to add the domain to your /etc/hosts file if you haven't already.