{
# Global options
  auto_https off
  servers {
            metrics
          }
}

:4000 {
# Root directory
  root * /usr/share/caddy

# Logging
  log {
        output stdout
        format json
      }

# Compression
  encode gzip zstd

# Configuration Template
  templates {
              mime application/json
            }

# Static Assets
  file_server

# API Proxy
  handle /api/* {
                  reverse_proxy api-gateway:8081
                }

# Health
  handle /health {
                   respond "healthy" 200
                 }

# SPA Routing (Last Resort)
  try_files {path} /index.html
}
