{$PRIMARY_DOMAIN}, {$SECONDARY_DOMAIN} {
  encode zstd gzip

  @secondary host {$SECONDARY_DOMAIN}
  redir @secondary https://{$PRIMARY_DOMAIN}{uri} permanent

  @next_static path /_next/static/*
  handle @next_static {
    root * /srv
    header Cache-Control "public, max-age=31536000, immutable"
    file_server
  }

  @public_assets {
    file {
      root /srv/public
      try_files {path}
    }
  }
  handle @public_assets {
    root * /srv/public
    header Cache-Control "public, max-age=3600"
    file_server
  }

  reverse_proxy dashboard:3000 {
    header_up Host {host}
    header_up X-Forwarded-Host {host}
    header_up X-Forwarded-Proto {scheme}
    header_up X-Forwarded-For {remote_host}
  }
}
