Skip to content

Vhosts

Create a Vhost

Two modes are available:

Guided Mode

  1. Enter the domain (e.g. app.example.com)
  2. Enter the filename — the name of the generated Caddyfile (auto-filled from the domain, e.g. app.example.com)
  3. Enter the upstream (e.g. http://backend:8080)
  4. Optional: add basic auth or custom headers
  5. Preview the generated configuration
  6. Submit

The Caddyfile configuration is automatically generated and includes the reverse proxy and log directives.

Raw Mode

For advanced configuration, switch to raw mode and write the Caddyfile configuration directly:

nginx
  reverse_proxy http://backend:8080
  log {
    output file /var/log/caddy/access.log {
      roll_size 100mb
      roll_keep 5
    }
    format json
  }

TIP

The Sync to raw button copies the guided mode configuration to the raw editor for further customization.

Enable / Disable

The toggle button enables or disables a vhost without deleting it. A disabled vhost is removed from the generated Caddyfile but remains in the database.

Edit / Delete

  • Edit: same interface as creation, pre-filled with current values
  • Delete: removes the vhost from the database and regenerates the Caddyfile

Deployment Flow

On each modification (create, update, delete, toggle):

User                 Hub (API)              Caddy
    |                    |                    |
    |-- POST /vhosts --> |                    |
    |                    |-- UPDATE DB -----> |
    |                    |-- generateCaddyfile|
    |                    |-- POST /load ----> |
    |                    |                    |-- OK
    |                    | <--- 200 --------- |
    | <--- 201 --------- |                    |

Automatic Rollback

If the Caddy reload fails, the database modification is automatically reverted. The previous configuration remains active.