Files
caddy/conf/Caddyfile.importer
2026-04-12 07:11:17 +02:00

80 lines
2.1 KiB
Caddyfile

# Caddyfile - Reverse Proxy Configuration
# Development setup för recipe-app + import-service
#
# Routing:
# - Frontend: :4000 → localhost/
# - Backend API: :3001 → localhost/api/
# - Import Service: :3000 → localhost/api/recipes/import/
#
# Production setup: Ersätt localhost med din domain
localhost {
# ============================================
# IMPORT SERVICE (Document Converter)
# ============================================
# Dessa endpoints måste komma FÖRST!
# POST /api/recipes/import/pdf - Importera PDF (preview)
# POST /api/recipes/import/pdf/save - Importera och spara
# GET /api/recipes/import/health - Health check
handle /api/recipes/import* {
reverse_proxy recipe-import-service:3000
}
# ============================================
# RECIPE FRONTEND PROXY ENDPOINTS
# ============================================
# Next.js API routes som proxy
handle /api/inventory-history-proxy {
reverse_proxy recipe-app-backend:3001
}
handle /api/admin/merge-preview-proxy {
reverse_proxy recipe-app-backend:3001
}
handle /api/recipe-preview-proxy {
reverse_proxy recipe-app-backend:3001
}
# ============================================
# RECIPE BACKEND API ENDPOINTS
# ============================================
handle /api/products* {
reverse_proxy recipe-app-backend:3001
}
handle /api/inventory* {
reverse_proxy recipe-app-backend:3001
}
handle /api/recipes* {
reverse_proxy recipe-app-backend:3001
}
# ============================================
# HEALTH CHECKS
# ============================================
handle /health {
reverse_proxy recipe-app-backend:3001
}
# ============================================
# CATCH ALL
# ============================================
# Övriga /api/* går till frontend
handle /api/* {
reverse_proxy recipe-app-frontend:4000
}
# Frontend - catch all remaining routes
reverse_proxy /* recipe-app-frontend:4000
# Enable gzip compression
encode gzip
}