diff --git a/HowtoDrupal.md b/HowtoDrupal.md index c4c437f4..b617e968 100644 --- a/HowtoDrupal.md +++ b/HowtoDrupal.md @@ -115,6 +115,31 @@ $ drush sql-connect $ drush status ~~~ +### Configuration derrière un reverse-proxy + +Dans la configuration de drupal, des directives sont à activer pour la prise en compte des headers HTTP X-Forwarded-For). + +~~~php +$settings['reverse_proxy'] = TRUE; + +$settings['reverse_proxy_addresses'] = ['192.0.2.1']; +~~~ + +Pour le HTTPS (signalé via X-Forwarded-Proto), il y a déjà des directives de configuration pour prendre ce réglage en compte. +Elles ressemblent à : + +~~~php + /** + * If external request was HTTPS but internal request is HTTP, set $_SERVER['HTTPS'] so Drupal detects the right scheme. + */ + if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && isset($_SERVER['REQUEST_SCHEME'])) { + if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' && $_SERVER["REQUEST_SCHEME"] == 'http') { + $_SERVER['HTTPS'] = 'on'; + } + } +~~~ + + ## Optimisation