リバースプロキシ(Apache)+バックグランドWeb(Drupal 7 )でログインセッションを維持する方法

カテゴリ Proxy コアバージョン 7.59 関連モジュール Proxy Apache settings.php

前提
・リバースプロキシのドメイン名: front.com
・バックグランドサーバーのドメイン名: background.com

Apache リバースプロキシ側の設定

・/etc/httpd/conf.d/proxy.conf など

ProxyRequests off
#SSLProxyEngine on // https -> https の場合は必要
<location>
        ProxyPass http://background.com/
        ProxyPassReverse http://background.com/
        ProxyPassReverseCookieDomain .background.com .front.com
        RequestHeader unset Accept-Encoding
        AddOutputFilterByType SUBSTITUTE text/plain text/html application/javascript text/javascript
        Substitute "s|http://background.com|http://front.com|q"
</location>

;

Drupal 7 バックグラウンド側の設定

・ドキュメントルート/site/default/settings.php

$cookie_domain = '.front.com';
$conf['reverse_proxy'] = TRUE;
$conf['reverse_proxy_addresses'] = ['リバースプロキシIPアドレス'];

OTHER FAQ