Based on your description and logs, the error:
Couldn't connect to server (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://localhost:8080/apps/673429/events?auth_key=...
means that your Laravel backend (when broadcasting events) cannot reach the Reverb server at localhost:8080. Even though your browser can connect, PHP (running inside your container or on your host) may not be able to.
This is a common issue when using Docker or similar setups. Here’s how to debug and solve it:
1. Check Where Laravel is Running
- If Laravel is running in a Docker container,
localhostrefers to the container itself, not your host machine. - If Reverb is running on your host, you need to use the host's network IP, not
localhost.
2. Solution: Use the Correct Host
If using Docker for Laravel:
- Change your
.env:
REVERB_HOST=host.docker.internal
host.docker.internalis a special DNS name that resolves to the host machine from inside Docker containers (works on Docker Desktop for Mac/Windows, and recent Docker for Linux).
If not using Docker:
- Make sure Reverb is running and listening on
localhost:8080. - From your terminal, try:
If you get a response, the server is up.curl http://localhost:8080
3. Check Firewall and Bind Address
- Make sure Reverb is listening on
0.0.0.0:8080(not just127.0.0.1:8080) if you want it accessible from other containers or machines. - In your Reverb config, set:
and restart Reverb.REVERB_HOST=0.0.0.0
4. Update Your Frontend Vite Config
- If you change the host, update your Vite variables as well:
VITE_REVERB_HOST=host.docker.internal
5. Restart Everything
- After changing
.env, run:php artisan config:clear php artisan cache:clear
6. Summary Table
| Where Laravel Runs | Where Reverb Runs | REVERB_HOST Value |
|---|---|---|
| Host | Host | localhost |
| Docker | Host | host.docker.internal |
| Docker | Docker | reverb (service name) |
Example: Docker Compose Setup
If both Laravel and Reverb are in Docker Compose, use the service name:
REVERB_HOST=reverb
Final Checklist
- Ensure Reverb is running and accessible from where PHP runs.
- Use the correct
REVERB_HOSTin your.env. - Clear Laravel config/cache after changes.
- If using Docker, prefer
host.docker.internalor the service name.
If you still have issues, please specify:
- Are you using Docker for Laravel? For Reverb?
- What OS are you on?
Let me know if you need more help!