This guide explains how to configure Laravel Reverb to work behind Nginx with a /ws/ WebSocket path prefix.
Using a custom path helps prevent conflicts with other routes and ensures WebSocket traffic is correctly proxied. This allows to run the WebSocket traffic on the same domain as the Web Server.
Oprtional: It also demonstrates how to authenticate connections using JWT tokens.
The following Nginx block forwards all /ws/ requests to the Reverb WebSocket server running locally on port 8080: