
How We Got DDEV, Laravel, and a Go API Talking: The Sidecar Approach
Ahnii! Our stack splits responsibilities: Laravel (DDEV) handles auth and the UI; a Go service serves the API. We needed the Laravel app inside DDEV to call the Go API reliably. Here’s how we did it. The Problem Laravel runs in a DDEV web container. Go was either on the host or in its own Docker Compose. From inside the web container, localhost:8090 points at the container itself, not the host. Using host.docker.internal:8090 led to timeouts (routing/WSL2) or required the Go app to listen on 0.0.0.0 . When we did get a response, we often saw 401 Unauthorized : the shared secret for signed requests didn’t match between Laravel and Go. We wanted one predictable setup: Laravel and Go on the same network, with a single place to configure the shared secret. The Solution: Go as a DDEV Sidecar We added the Go service (and its Postgres) as custom Docker Compose services in DDEV so they share the same Docker network as the web container and can talk by service name. Custom compose file Add a fi
Continue reading on Dev.to
Opens in a new tab



