Update BroadcastServiceProvider to include API versioning and enhanced middleware configuration. Revise Nginx configuration comments for clarity on broadcasting and websocket proxy setup.

This commit is contained in:
Mekan1206
2026-08-16 17:18:16 +05:00
parent 550ffea5c0
commit 57dd8ee378
2 changed files with 18 additions and 5 deletions

View File

@@ -17,6 +17,11 @@ class BroadcastServiceProvider extends ServiceProvider
{
Broadcast::routes(['middleware' => ['auth:sanctum']]);
Broadcast::routes([
'prefix' => 'api/v1',
'middleware' => ['api', 'api_token', 'auth:sanctum'],
]);
Broadcast::routes([
'prefix' => 'panel',
'middleware' => ['web', NovaAuthenticate::class, NovaAuthorize::class, EnsureChatOperator::class],

View File

@@ -1,10 +1,18 @@
# Laravel Reverb websocket proxy for mm.com.tm
# Laravel Reverb + broadcasting auth for mm.com.tm
#
# Paste this location into the existing HTTPS server { } for mm.com.tm,
# BEFORE any frontend SPA catch-all.
# Paste into the existing HTTPS server { } for mm.com.tm.
#
# Reverb (supervisor) stays on 127.0.0.1:8080.
# Browsers connect to wss://mm.com.tm/app/...
# 1) Laravel PHP prefixes MUST include `broadcasting`, otherwise
# POST /broadcasting/auth is caught by `location /` and proxied to
# the SPA on :4173 (404). Keep this in the same regex as api/panel:
#
# location ~ ^/(api|storage|panel|vendor|nova-api|nova-vendor|sanctum|nova|app-docs|broadcasting) {
# try_files $uri $uri/ /index.php?$query_string;
# }
#
# 2) Reverb (supervisor) stays on 127.0.0.1:8080.
# Browsers connect to wss://mm.com.tm/app/...
# Place `location /app` BEFORE the SPA `location /` catch-all.
location /app {
proxy_http_version 1.1;