fix: acceso público a imágenes de storage para WhatsApp y navegador
- Mueve la ruta /storage/{path} fuera del middleware de auth para que
sea pública; necesario para que los servidores de WhatsApp y el navegador
puedan cargar imágenes de promociones sin autenticación
- Dockerfile: agrega 'rm -rf public/storage' antes de storage:link para
evitar que COPY copie la junction de Windows y deje el symlink roto en el contenedor
- Crea .dockerignore: excluye public/storage, .git, .env y artefactos de
build del contexto de Docker para builds más limpios y seguros
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+7
-6
@@ -58,6 +58,12 @@ Route::get('/webhook/whatsapp', [\App\Http\Controllers\WhatsAppWebhookControlle
|
||||
Route::post('/webhook/whatsapp', [\App\Http\Controllers\WhatsAppWebhookController::class, 'handle'])
|
||||
->withoutMiddleware([\App\Http\Middleware\VerifyCsrfToken::class]);
|
||||
|
||||
Route::get('/storage/{path}', function (string $path) {
|
||||
$fullPath = storage_path('app/public/' . $path);
|
||||
abort_unless(file_exists($fullPath), 404);
|
||||
return response()->file($fullPath);
|
||||
})->where('path', '.*');
|
||||
|
||||
Route::middleware(['auth:sanctum',config('jetstream.auth_session'),'verified',
|
||||
])->group(function () {
|
||||
|
||||
@@ -160,12 +166,7 @@ Route::middleware(['auth:sanctum',config('jetstream.auth_session'),'verified',
|
||||
Route::resource('/plantel',PlantelController::class);
|
||||
Route::get('/registros', [CodeController::class,'registros' ])->name('registros');
|
||||
Route::resource('/role',RoleController::class);
|
||||
Route::get('/storage/{path}', function ($path) { $fullPath = storage_path('app/public/' . $path);
|
||||
if (!file_exists($fullPath)) {
|
||||
abort(404);
|
||||
}
|
||||
return response()->file($fullPath);
|
||||
})->where('path', '.*')->middleware('auth');
|
||||
|
||||
// Route::get('/test-chat', function () { broadcast(new MessageSent('Hola realtime ')); return 'Mensaje enviado';});
|
||||
Route::resource('/turno',TurnoController::class);
|
||||
Route::resource('/user',UserController::class);
|
||||
|
||||
Reference in New Issue
Block a user