Absolutely! Let's walk through the most common issues and solutions for running Laravel Reverb behind SSL (HTTPS) on a Forge server, especially when using a separate subdomain and Cloudflare.
Key Points to Check
-
Reverb Server Must Listen on 0.0.0.0 (already correct):
REVERB_SERVER_HOST=0.0.0.0 -
SSL Termination:
Forge typically handles SSL on the web server (nginx), not Reverb. DON’T run Reverb with internal SSL. Run it via HTTP (port 8080, not 443). nginx will proxy wss connections from the public to Reverb. -
Reverb actual server config:
REVERB_SERVER_PORT=8080 -
.env for frontend (correct):
VITE_REVERB_HOST=websockets.xxxxxx.xx VITE_REVERB_PORT=443 VITE_REVERB_SCHEME=https -
WebSocket proxy settings in nginx (Forge 'Sites > Edit Nginx Files > Websockets'):
Make sure you have a custom nginx config for the subdomain:Add into your subdomain's server block:
location /app/ { proxy_pass http://127.0.0.1:8080; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } -
Restart nginx after saving config changes.
-
Cloudflare settings:
- DNS: Make sure the subdomain is set to "DNS only" (grey cloud).
- Proxy Status: NO orange cloud. (WebSockets often won’t work when proxied by Cloudflare Free!)
- SSL/TLS: Should be "Full" or "Full (Strict)".
-
Reverb start script:
Run Reverb with:php artisan reverb:start --host=0.0.0.0 --port=8080Or set this up as a Forge daemon.
-
Check for firewall (UFW):
Port 8080 should NOT be exposed to the public; only nginx proxies to it. Double-check UFW or any firewall just in case.
Example: Final setup steps
Your .env is almost correct, just be sure NOT to set Reverb's server port to 443 internally.
Your nginx, for websockets subdomain, should have:
location /app/ {
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
Checklist
- Reverb running on 0.0.0.0:8080
- nginx proxies
/app/traffic to Reverb - SSL is handled by nginx, not Reverb itself
- Cloudflare DNS only (no proxy)
- VITE/Echo uses
wss://your-subdomain/443
Why you got a 404 in Postman
Reverb only listens on /app/ route for websocket upgrades, not normal HTTP. A plain GET in Postman to /app/ on port 443 → nginx → Reverb is not going to yield anything useful without an upgraded WebSocket handshake.
Debugging
- Watch your browser development console for actual websocket upgrade requests and errors.
- Use
php artisan reverb:statusto check if your server is running.
Let me know if you need a step-by-step guide for creating the nginx config on Forge!