'X_FORWARDED_PREFIX' =>
$trustedHeaderSet & Request::HEADER_X_FORWARDED_PREFIX,
];
foreach (array_filter($trustedHeaders) as $name =>
$key) { $request->headers->
remove($name);
$request->server->
remove('HTTP_'.
$name);
} } // compute trusted values, taking any trusted proxies into account
$trustedIps =
[];
$trustedValues =
[];
foreach (array_reverse($request->
getClientIps()) as $ip) { $trustedIps[] =
$ip;
$trustedValues[] =
sprintf('for="%s"',
$ip);
} if ($ip !==
$remoteAddr) { $trustedIps[] =
$remoteAddr;
$trustedValues[] =
sprintf('for="%s"',
$remoteAddr);
} // set trusted values, reusing as much as possible the global trusted settings
if (Request::HEADER_FORWARDED &
$trustedHeaderSet) { $trustedValues[0
] .=
sprintf(';host="%s";proto=%s',
$request->
getHttpHost(),
$request->
getScheme());