nginx icon indicating copy to clipboard operation
nginx copied to clipboard

Not possible to specify some configuration key multiple times.

Open chakrit opened this issue 11 years ago • 6 comments

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

chakrit avatar Feb 04 '14 18:02 chakrit

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 avatar Mar 14 '14 17:03 jdauphant

@jdauphant wow, thanks!

chakrit avatar Mar 16 '14 11:03 chakrit

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

isho avatar Jul 31 '14 17:07 isho

I guess I should switch to using this role?

https://galaxy.ansible.com/list#/roles/466

isho avatar Jul 31 '14 18:07 isho

Yes I have fix that in my role :)

jdauphant avatar Jul 31 '14 18:07 jdauphant

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:

srkiNZ84 avatar Nov 25 '15 07:11 srkiNZ84