b2in/bootstrap/app.php
Kevin Adametz 69d50eed0f Hotfix: Vorschau im Inhalte-Editor und Seitennavigation der Medienbibliothek
- AllowPortalFraming: frame-ancestors 'self' + Portal statt X-Frame-Options SAMEORIGIN,
  damit portal.b2in.eu die Website im Vorschau-iframe zeigen darf
- Medienbibliothek und Hub-Verwaltung: WithPagination – ohne zeigten die Seitenlinks nach
  dem ersten Livewire-Klick auf den Update-Endpunkt (405); Suche/Filter springen auf Seite 1

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 09:36:16 +00:00

60 lines
2.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
use App\Http\Controllers\HealthController;
use App\Http\Middleware\ReportErrorSignals;
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
use Illuminate\Support\Facades\Route;
use Sentry\Laravel\Integration;
use Symfony\Component\Console\Exception\CommandNotFoundException;
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__.'/../routes/domains.php',
commands: __DIR__.'/../routes/console.php',
health: '/up',
then: function (): void {
// Tiefer Health-Check für den externen Monitor (Uptime Kuma), auf jeder Domain
Route::get('/health', HealthController::class)
->middleware('throttle:30,1')
->name('health.deep');
},
)
->withMiddleware(function (Middleware $middleware) {
// Traefik Reverse-Proxy vertraut die X-Forwarded-Proto/For Headers
// damit $request->url() korrekt https:// zurückgibt (nötig für signierte Upload-URLs)
$middleware->trustProxies(at: '*');
// Domain-URL Konfiguration - muss ganz am Anfang ausgeführt werden
// um sicherzustellen, dass url() und asset() die richtige Domain verwenden
$middleware->prepend(\App\Http\Middleware\SetDomainUrl::class);
// Sprachwechsel aus Session anwenden
$middleware->appendToGroup('web', \App\Http\Middleware\SetLocale::class);
// Partner Setup-Zwang für eingeloggte User
$middleware->alias([
'partner.setup' => \App\Http\Middleware\EnsurePartnerSetupCompleted::class,
]);
// Fehler ohne Exception (toter interner Link, 403/429 für Angemeldete, 419) –
// global, weil 404 vor dem Routing entsteht
$middleware->append(ReportErrorSignals::class);
// Inhalte-Editor im Portal zeigt die Website im iframe: frame-ancestors statt SAMEORIGIN
$middleware->append(\App\Http\Middleware\AllowPortalFraming::class);
// BasicAuth ganz am Ende, nach Session-Middleware
if (env('BASIC_AUTH_ENABLED', true)) {
$middleware->append(\App\Http\Middleware\BasicAuthMiddleware::class);
}
})
->withExceptions(function (Exceptions $exceptions) {
// Gemeldete Exceptions an GlitchTip (ohne DSN ein No-op);
// Laravels dontReport (404, Validierung, Auth) gilt weiter
Integration::handles($exceptions);
// Vertippte artisan-Befehle sind kein Anwendungsfehler
$exceptions->dontReport(CommandNotFoundException::class);
})->create();