You are here

public static function Request::setTrustedHosts in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/http-foundation/Request.php \Symfony\Component\HttpFoundation\Request::setTrustedHosts()

Sets a list of trusted host patterns.

You should only list the hosts you manage using regexs.

Parameters

array $hostPatterns A list of trusted host patterns:

1 call to Request::setTrustedHosts()
RequestTest::testTrustedHosts in vendor/symfony/http-foundation/Tests/RequestTest.php

File

vendor/symfony/http-foundation/Request.php, line 570

Class

Request
Request represents an HTTP request.

Namespace

Symfony\Component\HttpFoundation

Code

public static function setTrustedHosts(array $hostPatterns) {
  self::$trustedHostPatterns = array_map(function ($hostPattern) {
    return sprintf('#%s#i', $hostPattern);
  }, $hostPatterns);

  // we need to reset trusted hosts on trusted host patterns change
  self::$trustedHosts = array();
}