Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

dam-man's avatar

Laravel Reverb not working on production server - Websocket connection Failed

I am getting this error when I am at my production server:

WebSocket connection to 'wss://localhost:8080/app/mjrhvwaous7au0soqplg?protocol=7&client=js&version=8.4.0-rc2&flash=false' failed

In my localhost everything is working properly, but it looks like my server is not accepting the connection. I am using ploi for server management. Which can spawn the reverb server.

This is my config:

REVERB_APP_ID=479663 REVERB_APP_KEY=mjrhvwaous7au0soqplg REVERB_APP_SECRET=mfvk84yhtsl3h1ywxda2 REVERB_HOST="localhost" REVERB_PORT=8080 REVERB_SCHEME=https

VITE_REVERB_APP_KEY="${REVERB_APP_KEY}" VITE_REVERB_HOST="${REVERB_HOST}" VITE_REVERB_PORT="${REVERB_PORT}" VITE_REVERB_SCHEME="${REVERB_SCHEME}"

And when I spawn the server it is showing this message:

reverb:start --host=127.0.0.1 --port=8080 --no-interaction --debug

This is giving me this output so it looks like it is working:

Pinging Inactive Connections ............................................... Pruning Stale Connections .................................................. Pinging Inactive Connections ............................................... Pruning Stale Connections ..................................................

Am I missing something?

0 likes
3 replies
dam-man's avatar

When I am trying to execute a command which triggers the event, I get this message:

Pusher error: cURL error 28: SSL connection timeout (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://localhost:8080/apps/
479663/events?auth_key=mjrhvwaous7au0soqplg&auth_timestamp=1734537945&auth_version=1.0&body_md5=3408992cd71110727b97ba78b26e7427&auth_signatu
re=105156a0f51b55435986d37ad79bff6f259e778f6a9ec0ca08061294a3c48683.

JussiMannisto's avatar

You should format the config you posted so that it's more readable.

Websocket connections are established between the browser and the websocket server. You've set REVERB_HOST to localhost. That means when someone visits the website, their browser tries to connect to a websocket server running at localhost (their own computer). That obviously won't work.

I recommend you read the Reverb documentation, especially the sections SSL and Running Reverb in Production:

https://laravel.com/docs/11.x/reverb#configuration

You'll have to secure the websocket connections in production. The easiest way is to proxy the connections through your web server (e.g. Nginx). That way the web server manages TLS/SSL sertificates, and you don't have to do that separately for the websocket endpoints.

How are you hosting the app?

jihuen's avatar

@JussiMannisto Hi, I'm running into quite similar problem. My Laravel app is running on Cloud Run container, which I've configured to run artisan reverb:start on Dockerfile. Since everything works on local Docker setup environment, I'm wondering if I'm missing anything crucial in order for this setup to work on production?

Please or to participate in this conversation.