{
	auto_https off
}

(security_headers) {
	header {
			X-Content-Type-Options "nosniff"
			X-Frame-Options "DENY"
			Referrer-Policy "strict-origin-when-cross-origin"
			Permissions-Policy "camera=(), microphone=(), geolocation=()"
			Content-Security-Policy "default-src 'self'; img-src 'self' data: blob: https:; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; connect-src 'self' https: wss:; font-src 'self' data:; frame-ancestors 'none'; object-src 'none'; base-uri 'self'"
			-Server
		}
	}

(app_routes) {
	encode zstd gzip
	request_body {
		max_size {$MAX_UPLOAD_SIZE:1024MB}
	}

	handle /api/metrics* {
		respond "not found" 404
	}

	handle /api/* {
		reverse_proxy backend:4000
	}

	handle_path /files/* {
		reverse_proxy minio:9000
	}

	handle /healthz {
		respond "ok" 200
	}

	reverse_proxy web:3000
}

:8082 {
	import security_headers
	import app_routes
}
