{ # Disable the Caddy admin API for security admin off } # Main site block, listens on port 8001 :5001 { # Custom error handling for 502 Bad Gateway handle_errors 502 { root * /data # Serve files from /data rewrite * /offline.html # Rewrite all requests to offline.html templates # Enable template processing file_server # Serve static files } # Route for database web UI route /dev/db/* { uri strip_prefix /dev/db # Remove /dev/db prefix reverse_proxy 127.0.0.1:8081 # Proxy to DB UI on port 8081 } # Default route: proxy all other requests to main app route /* { reverse_proxy 127.0.0.1:4000 # Proxy to main app } }