このページの翻訳:
- 日本語 (ja)
- English (en)
最近の更新
- 24 Bitwarden/Vaultwarden created
最近の更新
文書の過去の版を表示しています。
CF-Connecting-IP でリモートIPを取得
remoteip_moduleを利用
※Aache 2.4
sudo a2enmod remoteip sudo systemctl restart apache2 apachectl -M | grep remo remoteip_module (shared)
CloudflareからのヘッダCF-Connecting-IPを指定し、CloudflareのIPだけをリモートIPに変換する。
CloudflareのIPリストは、https://www.cloudflare.com/ja-jp/ips/
/etc/apache2/conf-available/remoteip.conf
LoadModule remoteip_module modules/mod_remoteip.so RemoteIPHeader CF-Connecting-IP RemoteIPInternalProxy 173.245.48.0/20 RemoteIPInternalProxy 103.21.244.0/22 RemoteIPInternalProxy 103.22.200.0/22 RemoteIPInternalProxy 103.31.4.0/22 RemoteIPInternalProxy 141.101.64.0/18 RemoteIPInternalProxy 108.162.192.0/18 RemoteIPInternalProxy 190.93.240.0/20 RemoteIPInternalProxy 188.114.96.0/20 RemoteIPInternalProxy 197.234.240.0/22 RemoteIPInternalProxy 198.41.128.0/17 RemoteIPInternalProxy 162.158.0.0/15 RemoteIPInternalProxy 104.16.0.0/13 RemoteIPInternalProxy 104.24.0.0/14 RemoteIPInternalProxy 172.64.0.0/13 RemoteIPInternalProxy 131.0.72.0/22
sudo a2enconf remoteip
sudo systemctl restart apache2
REMOTE_ADDR が CF-Connecting-IP になっているか確認
tail -f /var/log/apache2/access.log
あとは普通に.htaccessなどで制御
Order Deny,Allow Deny from all Allow from xxx.xxx.xxx.xxx Allow from xxx.xxx.xxx.xxx Allow from xxx.xxx.xxx.xxx