| Server IP : 35.80.110.71 / Your IP : 216.73.216.221 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ip-172-31-21-44 6.17.0-1019-aws #19~24.04.1-Ubuntu SMP Tue Jun 23 18:53:06 UTC 2026 x86_64 User : ubuntu ( 1000) PHP Version : 8.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/switchyard/current/bootstrap/ |
Upload File : |
<?php
use App\Http\Responses\ProblemResponse;
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
use Illuminate\Http\Request;
use Illuminate\Validation\ValidationException;
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__.'/../routes/web.php',
api: __DIR__.'/../routes/api.php',
commands: __DIR__.'/../routes/console.php',
health: '/up',
apiPrefix: '',
)
->withMiddleware(function (Middleware $middleware): void {
$middleware->alias([
'api.key' => \App\Http\Middleware\ApiKeyAuth::class,
'workspace.rate-limit' => \App\Http\Middleware\WorkspaceRateLimit::class,
'demo.rate-limit' => \App\Http\Middleware\DemoRateLimit::class,
]);
// Trust forwarding headers so per-IP rate limit reads the real client
// IP, not the loopback Apache proxy IP. The host runs Apache → php-fpm
// and (when fronted by Cloudflare) Cloudflare → Apache.
$middleware->trustProxies(at: '*');
// Unauthenticated hits on non-JSON web routes (e.g. /oauth/clickup/connect)
// would otherwise blow up with "Route [login] not defined" — the Filament
// panel's login route is `filament.admin.auth.login`, not the generic
// `login` Laravel looks for by default.
$middleware->redirectGuestsTo(fn (Request $request) => $request->expectsJson()
? null
: route('filament.admin.auth.login'));
})
->withExceptions(function (Exceptions $exceptions): void {
$exceptions->shouldRenderJsonWhen(
fn (Request $request) => $request->is('v1/*') || $request->expectsJson(),
);
// Validation errors get a 400 problem+json with field-level errors.
$exceptions->render(function (ValidationException $e, Request $request) {
if (! ($request->is('v1/*') || $request->expectsJson())) {
return null;
}
return new ProblemResponse(
status: 400,
title: 'Invalid request',
detail: 'The request body failed validation.',
errors: $e->errors(),
);
});
// Everything else maps via ProblemResponse::for.
$exceptions->render(function (\Throwable $e, Request $request) {
if (! ($request->is('v1/*') || $request->expectsJson())) {
return null;
}
return ProblemResponse::for($e);
});
})->create();