nginx
nginx copied to clipboard
Not possible to specify some configuration key multiple times.
Example is the proxy_set_header that should allows us to adds multiple headers to requests. This fails due to the nature of YML — when specifying multiple keys the last entry simply overrides it.
Example in YML:
nginx_sites:
- server:
file_name: app
listen: 80
server_name: 'ubuntu1204'
location1:
name: '/'
proxy_pass: 'http://0.0.0.0:8080'
proxy_redirect: "off"
proxy_buffering: "off"
proxy_set_header: 'Host $host'
proxy_set_header: 'X-Real-IP $remote_addr'
proxy_set_header: 'X-Forwarded-For $proxy_add_x_forwarded_for'
Resulting configuration output:
location / {
proxy_buffering off;
proxy_pass http://0.0.0.0:8080;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
}
See also: http://wiki.nginx.org/HttpProxyModule
I have made pullrequest that correct this problem : https://github.com/bennojoy/nginx/pull/3 My fork is also available in galaxy repository : https://galaxy.ansible.com/list#/roles/466 This fork change the syntax.
@jdauphant wow, thanks!
Is this fix going in anytime soon?
I ran into a similar issue configuring SSL. I would love to be able to use Nginx's ability to configure both http and https ports in one server directive like so:
- server:
listen: 80
listen: 443 ssl
I guess I should switch to using this role?
https://galaxy.ansible.com/list#/roles/466
Yes I have fix that in my role :)
Just got hit by this as well. Will switch to @jdauphant's role. Hoping it's an easy switch over.
I do note that Ubuntu is not mentioned in the "Supported Platform's" list: https://galaxy.ansible.com/detail#/role/466 hoping this is just meaning that there's no formal testing on Ubuntu.
Thank you! :smile: