You are here

public function ReverseProxyMiddlewareTest::reverseProxyEnabledProvider in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php \Drupal\Tests\Core\StackMiddleware\ReverseProxyMiddlewareTest::reverseProxyEnabledProvider()
  2. 10 core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php \Drupal\Tests\Core\StackMiddleware\ReverseProxyMiddlewareTest::reverseProxyEnabledProvider()

Data provider for testReverseProxyEnabled.

File

core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php, line 62

Class

ReverseProxyMiddlewareTest
Unit test the reverse proxy stack middleware.

Namespace

Drupal\Tests\Core\StackMiddleware

Code

public function reverseProxyEnabledProvider() {
  return [
    'Proxy with default trusted headers' => [
      [
        'reverse_proxy_addresses' => [
          '127.0.0.2',
          '127.0.0.3',
        ],
      ],
      Request::HEADER_FORWARDED | Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO,
    ],
    'Proxy with AWS trusted headers' => [
      [
        'reverse_proxy_addresses' => [
          '127.0.0.2',
          '127.0.0.3',
        ],
        'reverse_proxy_trusted_headers' => Request::HEADER_X_FORWARDED_AWS_ELB,
      ],
      Request::HEADER_X_FORWARDED_AWS_ELB,
    ],
    'Proxy with custom trusted headers' => [
      [
        'reverse_proxy_addresses' => [
          '127.0.0.2',
          '127.0.0.3',
        ],
        'reverse_proxy_trusted_headers' => Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST,
      ],
      Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST,
    ],
  ];
}