Files
2026-06-24 17:20:43 +09:00

25 lines
667 B
PHP
Raw Permalink 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
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
/**
* Принудительное использование HTTPS вне локальной среды.
*
* Мера ФСТЭК: ИАФ.5, ЗИС.9 — защита данных при передаче (TLS обязателен).
*/
class ForceHttps
{
public function handle(Request $request, Closure $next): Response
{
if (! $request->isSecure() && ! app()->environment('local', 'testing')) {
return redirect()->secure($request->getRequestUri(), 301);
}
return $next($request);
}
}