Skip to content

Commit 2570846

Browse files
KevinjilBHenkemans
andcommitted
Add option to configure NGINX real ip
Co-authored-by: Bartjan Henkemans <[email protected]>
1 parent 2f5704c commit 2570846

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# If set, configure the real_ip_from header in NGINX to trust a proxy
2+
# FRONT_REVERSE_PROXY: 192.168.0.1

provision-contest/ansible/roles/domserver/templates/nginx-domjudge-inner.j2

+5
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,10 @@ add_header X-Content-Type-Options "nosniff";
6969
add_header X-XSS-Protection "1; mode=block";
7070
add_header X-Robots-Tag "none" always;
7171

72+
{% if FRONT_REVERSE_PROXY is defined %}
73+
set_real_ip_from {{ FRONT_REVERSE_PROXY }};
74+
real_ip_header X-Forwarded-For;
75+
{% endif %}
76+
7277
error_log /var/log/nginx/domjudge.log;
7378
access_log /var/log/nginx/domjudge.log dj_access;

0 commit comments

Comments
 (0)