Files
animexe/bootstrap/app.php
T
AyrisAIandClaude Sonnet 5 2001fa7952 fix: trust Coolify/Traefik reverse proxy headers
Without trustProxies(), Laravel didn't know requests arriving via
Traefik were originally HTTPS, so route()/url() generated http://
links (stream/proxy, vtt-proxy, etc.), which browsers block as mixed
content on the HTTPS page. Also corrected APP_URL in Coolify's env
vars from http://localhost/ to https://animexe.com.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-18 12:05:26 +03:00

44 lines
1.9 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 Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
use Illuminate\Http\Request;
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__.'/../routes/web.php',
api: __DIR__.'/../routes/api.php',
commands: __DIR__.'/../routes/console.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware): void {
// Coolify/Traefik SSL'i kendi katmanında sonlandırıyor; X-Forwarded-* header'larına
// güvenmezsek route()/url() hep http:// üretir (mixed content hatalarına yol açar).
$middleware->trustProxies(
at: '*',
headers: Request::HEADER_X_FORWARDED_FOR
| Request::HEADER_X_FORWARDED_HOST
| Request::HEADER_X_FORWARDED_PORT
| Request::HEADER_X_FORWARDED_PROTO
| Request::HEADER_X_FORWARDED_AWS_ELB,
);
$middleware->alias([
'admin' => \App\Http\Middleware\AdminMiddleware::class,
'admin.access' => \App\Http\Middleware\AdminAccessMiddleware::class,
'import.api' => \App\Http\Middleware\ImportApiMiddleware::class,
'secure.player' => \App\Http\Middleware\SecurePlayer::class,
]);
// Giriş yapılmamış kullanıcıyı frontend login sayfasına yönlendir
$middleware->redirectGuestsTo(fn () => route('frontend.login'));
// Bot koruması tüm web isteklerine uygula
$middleware->web(\App\Http\Middleware\BotDetector::class);
// SEO yönlendirmeleri
$middleware->web(\App\Http\Middleware\SeoRedirectMiddleware::class);
// iyzico callback CSRF muaf
$middleware->validateCsrfTokens(except: ['checkout/callback']);
})
->withExceptions(function (Exceptions $exceptions): void {
//
})->create();