Procházet zdrojové kódy

Merge pull request #30 from the-control-group/feature/set-real-ip

Support http_realip module
susefix
Seth House před 10 roky
rodič
revize
7febd2deb6
2 změnil soubory, kde provedl 11 přidání a 0 odebrání
  1. +7
    -0
      nginx/templates/config.jinja
  2. +4
    -0
      pillar.example

+ 7
- 0
nginx/templates/config.jinja Zobrazit soubor

} }


http { http {
{% if 'set_real_ips' in nginx -%}
{% for ip in nginx.get('set_real_ips', {}).get('from_ips', []) -%}
set_real_ip_from {{ ip }};
{% endfor -%}
real_ip_header {{ nginx.get('set_real_ips', {}).get('real_ip_header', 'X-Forwarded-For') }};

{% endif -%}
include /etc/nginx/mime.types; include /etc/nginx/mime.types;
default_type {{ nginx.get('default_type', 'application/octet-stream') }}; default_type {{ nginx.get('default_type', 'application/octet-stream') }};
log_format main '$scheme://$host:$server_port$uri$is_args$args $remote_addr:$remote_user "$request" $request_time $request_length:$bytes_sent $status "$http_referer" "$http_user_agent" "$http_x_forwarded_for"'; log_format main '$scheme://$host:$server_port$uri$is_args$args $remote_addr:$remote_user "$request" $request_time $request_length:$bytes_sent $status "$http_referer" "$http_user_agent" "$http_x_forwarded_for"';

+ 4
- 0
pillar.example Zobrazit soubor

user_auth_enabled: True user_auth_enabled: True
with_luajit: False with_luajit: False
with_openresty: True with_openresty: True
set_real_ips: # NOTE: to use this, nginx must have http_realip module enabled
from_ips:
- 10.10.10.0/24
real_ip_header: X-Forwarded-For
modules: modules:
headers-more: headers-more:
source: http://github.com/agentzh/headers-more-nginx-module/tarball/v0.21 source: http://github.com/agentzh/headers-more-nginx-module/tarball/v0.21

Načítá se…
Zrušit
Uložit