ANXS / nginx

A fairly flexible and feature full Ansible role for the NGINX web server.
MIT License
151 stars 82 forks source link

Fix #28. Allow directives with the same name. #64

Open Couto opened 9 years ago

Couto commented 9 years ago

It's the first time that I use the Jinja2 template system, so I'm not really sure about the correctness of this fix.

I wanted to reuse multiple directives with the same name, much like specified in #28 e.g.:

- server:
  listen: '[::]:443 ssl'
  listen: '443 ssl'
  location1: 
    name: /
    proxy_set_header: X-Real-IP $remote_addr
    proxy_set_header: Upgrade $http_upgrade
    proxy_set_header: Connection $connection_upgrade

However this doesn't work.

With this PR (that might need testing by someone with more experience than me) the following should work:

- server:
  listen:
    - '[::]:443 ssl'
    - '443 ssl'
  location1: 
    name: /
    proxy_set_header: 
      - 'X-Real-IP $remote_addr'
      - 'Upgrade $http_upgrade'
      - 'Connection $connection_upgrade'
otakup0pe commented 7 years ago

I've run into this problem as well. Will take a look at your PR but conceptually I think this looks fine to me :)