Skip to content

Commit

Permalink
Fixes issue 415 - set_real_ip_from should support a list
Browse files Browse the repository at this point in the history
The set_real_ip_from paremeter from the ngx_http_realip_module may be specified
multiple times within the http, server & location contexts. This commit adds
list support whilst preserving original behaviour (single-valued string).
Resolves issue nginxinc#415.
  • Loading branch information
Grant Byers committed Mar 21, 2024
1 parent 68601af commit 7b29d2b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions templates/http/modules.j2
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,11 @@ mirror_request_body {{ mirror['request_body'] | ternary('on', 'off') }};
{# NGINX HTTP RealIP -- ngx_http_realip_module #}
{% macro realip(realip) %}
{% if realip['set_real_ip_from'] is defined %}
{% for set_real_ip_from in realip['set_real_ip_from'] if realip['set_real_ip_from'] is not string %}
set_real_ip_from {{ set_real_ip_from }};
{% else %}
set_real_ip_from {{ realip['set_real_ip_from'] }};
{% endfor %}
{% endif %}
{% if realip['real_ip_header'] is defined %}
real_ip_header {{ realip['real_ip_header'] }};
Expand Down

0 comments on commit 7b29d2b

Please sign in to comment.