added x-forward-ip support

This commit is contained in:
nd 2019-05-21 19:50:39 +02:00
parent 0e8c531d0b
commit b0fe6bb0ee
No known key found for this signature in database
GPG key ID: 21B5CD4DEE3670E9
5 changed files with 16 additions and 2 deletions

View file

@ -3,6 +3,9 @@ resolver:
- 8.8.4.4
nginx:
real_ip_from:
"127.0.0.1": {}
"::1": {}
monitoring: true
serverpki: true
php: false

View file

@ -18,7 +18,7 @@
- name: execute ssl template
template:
src: ssl_files.j2
src: ssl_files.conf.j2
dest: /etc/nginx/conf.d/ssl_files.conf
notify:
- restart nginx
@ -37,10 +37,17 @@
notify:
- restart nginx
- name: execute proxy template
template:
src: proxy.conf.j2
dest: /etc/nginx/conf.d/proxy.conf
notify:
- restart nginx
- name: create nginx vhosts
template:
src: vhost.conf.j2
dest: "/etc/nginx/sites-available/{{ item.key }}"
src: vhost.j2
with_dict: "{{ nginx.vhosts }}"
notify:
- restart nginx

4
templates/proxy.conf.j2 Normal file
View file

@ -0,0 +1,4 @@
{% for ip in nginx.real_ip_from %}
set_real_ip_from {{ ip }};
{% endfor %}
real_ip_header X-Forwarded-For;