public static function Request::setTrustedHeaderName in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/http-foundation/Request.php \Symfony\Component\HttpFoundation\Request::setTrustedHeaderName()
Sets the name for trusted headers.
The following header keys are supported:
- Request::HEADER_CLIENT_IP: defaults to X-Forwarded-For (see getClientIp())
- Request::HEADER_CLIENT_HOST: defaults to X-Forwarded-Host (see getHost())
- Request::HEADER_CLIENT_PORT: defaults to X-Forwarded-Port (see getPort())
- Request::HEADER_CLIENT_PROTO: defaults to X-Forwarded-Proto (see getScheme() and isSecure())
Setting an empty value allows to disable the trusted header for the given key.
Parameters
string $key The header key:
string $value The header name:
Throws
\InvalidArgumentException
4 calls to Request::setTrustedHeaderName()
- InlineFragmentRendererTest::testESIHeaderIsKeptInSubrequestWithTrustedHeaderDisabled in vendor/
symfony/ http-kernel/ Tests/ Fragment/ InlineFragmentRendererTest.php - InlineFragmentRendererTest::testRenderWithTrustedHeaderDisabled in vendor/
symfony/ http-kernel/ Tests/ Fragment/ InlineFragmentRendererTest.php - RequestTest::testSetTrustedProxiesInvalidHeaderName in vendor/
symfony/ http-foundation/ Tests/ RequestTest.php - @expectedException \InvalidArgumentException
- RequestTest::testTrustedProxies in vendor/
symfony/ http-foundation/ Tests/ RequestTest.php
File
- vendor/
symfony/ http-foundation/ Request.php, line 606
Class
- Request
- Request represents an HTTP request.
Namespace
Symfony\Component\HttpFoundationCode
public static function setTrustedHeaderName($key, $value) {
if (!array_key_exists($key, self::$trustedHeaders)) {
throw new \InvalidArgumentException(sprintf('Unable to set the trusted header name for key "%s".', $key));
}
self::$trustedHeaders[$key] = $value;
}