Configuring Cloudflare reverse proxy for Drupal 8 websites

Pedro Gomes
1 min readMay 18, 2020


If you’re searching online and getting nowhere, this is for you. Reverse proxy settings, sound like an easy 3 line change, but you may be having issues making it work.

One possible reason, copy pasting solutions online isn’t working: settings.php.


Since Drupal 8.7, settings.php has been updated, and you must update your settings file to have the reverse proxy settings work.

Get the latest settings.php from drupal 8.8.x branch on this url:

Before, you had to specify the header you wish Drupal:

$settings['reverse_proxy_header'] = 'HTTP_CF_CONNECTING_IP';

Alternatively, there is some suggestions of overwriting the global variable.


Now, you must provide a flag regarding what headers you allow:

$settings['reverse_proxy_trusted_headers'] = \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_ALL;

See source code related to the flag above, at