Instead of location ws, you may want to use:
/ws
or
@ws
```
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
When changing Laravel Websockets from Beyondco to Laravel Reverb. I have the following problem: The Laravel reverb server logs "Connection Established" but the client does not receive this. After some time the client will give a "WebSocket was closed before the connection was established" error. The Laravel Reverb server does not seem to throw an error of some kind. It just logs that the "Connection Closed". Does anyone have an idea how I would be able to fix this problem?
Nginx:
location @ws {
# There is http:// before the 127.0.0.1, but I may not post a link right now
proxy_pass 127.0.0.1:6001;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-VerifiedViaNginx yes;
proxy_read_timeout 60;
proxy_connect_timeout 60;
proxy_redirect off;
# Specific for websockets: force the use of HTTP/1.1 and set the Upgrade header
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location /app/ {
try_files /nonexistent @ws;
}
location /apps/ {
try_files /nonexistent @ws;
}
Please or to participate in this conversation.