function ReverseProxyMiddleware::setSettingsOnRequest
Same name in other branches
- 8.9.x core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php \Drupal\Core\StackMiddleware\ReverseProxyMiddleware::setSettingsOnRequest()
- 10 core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php \Drupal\Core\StackMiddleware\ReverseProxyMiddleware::setSettingsOnRequest()
- 11.x core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php \Drupal\Core\StackMiddleware\ReverseProxyMiddleware::setSettingsOnRequest()
Sets reverse proxy settings on Request object.
Parameters
\Symfony\Component\HttpFoundation\Request $request: A Request instance.
\Drupal\Core\Site\Settings $settings: The site settings.
3 calls to ReverseProxyMiddleware::setSettingsOnRequest()
- install_begin_request in core/
includes/ install.core.inc - Begins an installation request, modifying the installation state as needed.
- ReverseProxyMiddleware::handle in core/
lib/ Drupal/ Core/ StackMiddleware/ ReverseProxyMiddleware.php - UpdateKernel::handle in core/
lib/ Drupal/ Core/ Update/ UpdateKernel.php
File
-
core/
lib/ Drupal/ Core/ StackMiddleware/ ReverseProxyMiddleware.php, line 59
Class
- ReverseProxyMiddleware
- Provides support for reverse proxies.
Namespace
Drupal\Core\StackMiddlewareCode
public static function setSettingsOnRequest(Request $request, Settings $settings) {
// Initialize proxy settings.
if ($settings->get('reverse_proxy', FALSE)) {
$proxies = $settings->get('reverse_proxy_addresses', []);
if (count($proxies) > 0) {
// Set the default value. This is the most relaxed setting possible and
// not recommended for production.
$trusted_header_set = Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO | Request::HEADER_FORWARDED;
$request::setTrustedProxies($proxies, $settings->get('reverse_proxy_trusted_headers', $trusted_header_set));
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.