feat: Add Real IP forwarding feature for bare-metal clusters
All checks were successful
Helm Chart Release / release-chart (push) Successful in 12s

ベアメタルKubernetesクラスターやLoadBalancer環境において、
PHP側で訪問者の実IPアドレスを取得できる機能を追加。

Changes:
- Add nginx.forwardRealIP configuration in values.yaml
- Implement real_ip_header and set_real_ip_from in Nginx config
- Pass real IP info to PHP-FPM via fastcgi_param
- Add usage example and documentation in README.md
- Create test-real-ip.php for verification
- Update chart version to 8.5.2-a

Features:
- Compatible with existing customConfig.snippet
- Configurable trusted proxy networks
- Supports multi-tier proxy with recursive option
- Default disabled for backward compatibility

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-10 09:21:55 +09:00
parent 59a21fca9b
commit 02696fc55e
6 changed files with 434 additions and 3 deletions

View File

@@ -55,6 +55,31 @@ nginx:
enabled: false
snippet: |-
# リアルIP転送設定ベアメタル/LoadBalancer環境向け
forwardRealIP:
# リアルIP取得機能を有効化
enabled: false
# リアルIPを取得するヘッダー名
# LoadBalancer/Ingressによって異なる
# - X-Real-IP: シンプルな1段プロキシ
# - X-Forwarded-For: 多段プロキシ対応(推奨)
header: "X-Forwarded-For"
# 再帰的にリアルIPを検索多段プロキシ環境で推奨
recursive: true
# 信頼するプロキシのネットワーク範囲
# ベアメタルクラスターでは、PodネットワークとServiceネットワークを指定
trustedProxies:
- "10.0.0.0/8" # プライベートネットワーク
- "172.16.0.0/12" # プライベートネットワーク
- "192.168.0.0/16" # プライベートネットワーク
# 追加で信頼するプロキシ(環境に応じてカスタマイズ)
additionalTrustedProxies: []
# - "203.0.113.0/24" # 外部LoadBalancerなど
# Composer設定
composer:
# Composerを使用するかどうか