I have a middleware to rediret to HTTPS like so:
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
class HttpsProtocolMiddleware
{
public function handle($request, Closure $next)
{
if (!$request->secure() && app()->environment('production')) {
dd("need to redirect");
return redirect()->secure($request->getRequestUri());
}
return $next($request);
}
}
However it is not working since if go to https://project.domain.com
i get a too many redirection
from the browser (and now with the dd
I see the dumo even if i go to my website through HTTPS)
EDIT:
I've already tested adding
Request::setTrustedProxies([$request->getClientIp()],Request::HEADER_X_FORWARDED_ALL);
as first line, and in TrustProxies
protected $proxies = '*';
but without success