File tree Expand file tree Collapse file tree 6 files changed +43
-1
lines changed Expand file tree Collapse file tree 6 files changed +43
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ ENHANCEMENTS:
10
10
11
11
* Bump the Ansible ` community.general ` collection to ` 4.6.1 ` and ` community.docker ` collection to ` 2.2.1 ` .
12
12
* Add labels to loops in ` tasks/config/template-config.yml ` to reduce amount of output data.
13
- * Add the ` map ` and ` split_clients ` directives into the ` http ` core template.
13
+ * Implement the ` map ` , ` realip ` and ` split_clients ` modules into the ` http ` core template.
14
14
* Streamline configuring SELinux.
15
15
16
16
BUG FIXES:
Original file line number Diff line number Diff line change @@ -641,6 +641,10 @@ nginx_config_http_template:
641
641
content : # Dictionary or list of dictionaries
642
642
- value : default
643
643
new_value : 0
644
+ realip : # Configure RealIP directives
645
+ set_real_ip_from : 0.0.0.0
646
+ real_ip_header : X-Real-IP
647
+ real_ip_recursive : false # Boolean
644
648
rewrite : # Configure rewrite directives
645
649
return : # Can also be set to a return URL or code directly -- Not available in the 'http' context
646
650
code : 200 # Required -- You have to set either 'code' or 'url'
Original file line number Diff line number Diff line change 502
502
new_value : 0
503
503
- value : ' "~jndi:ldap"'
504
504
new_value : 1
505
+ realip :
506
+ set_real_ip_from : 0.0.0.0
507
+ real_ip_header : X-Real-IP
508
+ real_ip_recursive : false
505
509
rewrite :
506
510
log : false
507
511
uninitialized_variable_warn : false
Original file line number Diff line number Diff line change 296
296
new_value : 0
297
297
- value : ' "~jndi:ldap"'
298
298
new_value : 1
299
+ realip :
300
+ set_real_ip_from : 0.0.0.0
301
+ real_ip_header : X-Real-IP
302
+ real_ip_recursive : false
299
303
rewrite :
300
304
log : false
301
305
uninitialized_variable_warn : false
Original file line number Diff line number Diff line change 84
84
{% from 'http/modules.j2' import map with context %}
85
85
{{ map(item['config'] ['map'] ) }}
86
86
{% - endif %}
87
+ {% if item ['config' ]['realip' ] is defined %}
88
+ {% from 'http/modules.j2' import realip with context %}
89
+ {{ realip(item['config'] ['realip'] ) }}
90
+ {% - endif %}
87
91
{% if item ['config' ]['rewrite' ] is defined %}
88
92
{% from 'http/modules.j2' import rewrite with context %}
89
93
{{ rewrite(item['config'] ['rewrite'] ) }}
@@ -218,6 +222,12 @@ server {
218
222
{{ log(server['log'] ) }}
219
223
{% - endfilter %}
220
224
{% endif %}
225
+ {% if server ['realip' ] is defined %}
226
+ {% from 'http/modules.j2' import realip with context %}
227
+ {% filter indent (4) %}
228
+ {{ realip(server['realip'] ) }}
229
+ {% - endfilter %}
230
+ {% endif %}
221
231
{% if server ['rewrite' ] is defined %}
222
232
{% from 'http/modules.j2' import rewrite with context %}
223
233
{% filter indent (4) %}
@@ -348,6 +358,12 @@ server {
348
358
{{ log(location['log'] ) }}
349
359
{% - endfilter %}
350
360
{% endif %}
361
+ {% if location ['realip' ] is defined %}
362
+ {% from 'http/modules.j2' import realip with context %}
363
+ {% filter indent (8) %}
364
+ {{ realip(location['realip'] ) }}
365
+ {% - endfilter %}
366
+ {% endif %}
351
367
{% if location ['rewrite' ] is defined %}
352
368
{% from 'http/modules.j2' import rewrite with context %}
353
369
{% filter indent (8) %}
Original file line number Diff line number Diff line change @@ -225,6 +225,20 @@ map {{ map_data['string'] }} {{ map_data['variable'] }} {
225
225
226
226
{% endmacro %}
227
227
228
+ {# NGINX HTTP RealIP -- ngx_http_realip_module #}
229
+ {% macro realip (realip ) %}
230
+ {% if realip ['set_real_ip_from' ] is defined %}
231
+ set_real_ip_from {{ realip['set_real_ip_from'] }};
232
+ {% endif %}
233
+ {% if realip ['real_ip_header' ] is defined %}
234
+ real_ip_header {{ realip['real_ip_header'] }};
235
+ {% endif %}
236
+ {% if realip ['real_ip_recursive' ] is defined and realip ['real_ip_recursive' ] is boolean %}
237
+ real_ip_recursive {{ realip['real_ip_recursive'] | ternary('on', 'off') }};
238
+ {% endif %}
239
+
240
+ {% endmacro %}
241
+
228
242
{# NGINX HTTP Rewrite -- ngx_http_rewrite_module #}
229
243
{% macro rewrite (rewrite ) %}
230
244
{% if rewrite ['return' ] is defined %} {# 'return' directive is not available in the 'http' context #}
You can’t perform that action at this time.
0 commit comments