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:

  1. Open the site in Tun
  2. Go to the "Overview" tab
  3. Click the routing mode dropdown
  4. Select your preferred mode
  5. 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:

  1. Open the site in Tun
  2. Go to the "Overview" tab
  3. Click the routing mode dropdown
  4. Select your preferred mode (hostname or localhost)
  5. 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.