{
	layer4 {
		:25 {
			route {
				proxy {
					upstream windmill_server:2525
				}
			}
		}
	}
}

{$BASE_URL} {
        # Default to all interfaces (IPv4 + IPv6) when ADDRESS is unset. A bare
        # `bind {$ADDRESS}` with an empty value makes Caddy >= 2.9 drop this whole
        # site, silently disabling the HTTP proxy while the :25 layer4 listener stays up.
        bind {$ADDRESS:0.0.0.0 ::}

        # Extra services: LSP, Multiplayer, Debugger (windmill_extra gateway).
        # reverse_proxy only reads its first argument as a matcher, so listing
        # several paths inline turns the rest into upstream addresses. The paths
        # have to go through a named matcher.
        @extra path /ws/* /ws_mp/* /ws_debug/*
        reverse_proxy @extra http://windmill_extra:3000

        # Search indexer, Enterprise Edition (windmill_indexer:8002)
        # reverse_proxy /api/srch/* http://windmill_indexer:8002

        # Default: Windmill server
        reverse_proxy /* http://windmill_server:8000

        # TLS with custom certificates
        # tls /certs/cert.pem /certs/key.pem
}
