From 6533f41f48c6d2cb1fe80a11d4561f230501b9db Mon Sep 17 00:00:00 2001 From: Florent Daigniere Date: Sat, 28 Jan 2023 17:37:16 +0100 Subject: [PATCH] Trust the IP address from the local subnet This will only work when SUBNET autodetection is merged --- webmails/nginx-webmail.conf | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/webmails/nginx-webmail.conf b/webmails/nginx-webmail.conf index 1794a635..1bc00912 100644 --- a/webmails/nginx-webmail.conf +++ b/webmails/nginx-webmail.conf @@ -26,6 +26,14 @@ server { add_header X-Permitted-Cross-Domain-Policies "none" always; add_header Referrer-Policy "no-referrer" always; + real_ip_header X-Real-IP; + {% for from_ip in SUBNET.split(',') %} + set_real_ip_from {{ from_ip }}; + {% endfor %} + {% if SUBNET6 %}{% for from_ip in SUBNET6.split(',') %} + set_real_ip_from {{ from_ip }}; + {% endfor %}{% endif %} + location / { try_files $uri $uri/ /index.php$args; }