function ReverseProxyMiddlewareTest::reverseProxyEnabledProvider

Same name in other branches
  1. 9 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()
  3. 11.x 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 64

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_ALL,
        ],
        '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,
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.