Configuring Cloudflare reverse proxy for Drupal 8 websites

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.

See https://www.drupal.org/node/3030558

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:

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

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

See source code related to the flag above, at https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/Request.php#L42