[nginx] Reverse WebSocket
							parent
							
								
									e8b0d14a55
								
							
						
					
					
						commit
						6eaf509ff3
					
				| 
						 | 
					@ -74,7 +74,7 @@
 | 
				
			||||||
        # Services web Crans
 | 
					        # Services web Crans
 | 
				
			||||||
        - {from: lutim.crans.org, to: 10.231.136.69}
 | 
					        - {from: lutim.crans.org, to: 10.231.136.69}
 | 
				
			||||||
        - {from: zero.crans.org, to: 10.231.136.76}
 | 
					        - {from: zero.crans.org, to: 10.231.136.76}
 | 
				
			||||||
        - {from: pad.crans.org, to: 10.231.136.76}
 | 
					        - {from: pad.crans.org, to: "10.231.136.76:9001"}
 | 
				
			||||||
        - {from: ethercalc.crans.org, to: 10.231.136.203}
 | 
					        - {from: ethercalc.crans.org, to: 10.231.136.203}
 | 
				
			||||||
        - {from: mediadrop.crans.org, to: 10.231.136.106}
 | 
					        - {from: mediadrop.crans.org, to: 10.231.136.106}
 | 
				
			||||||
        - {from: videos.crans.org, to: 10.231.136.106}
 | 
					        - {from: videos.crans.org, to: 10.231.136.106}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,8 +11,11 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- name: Copy snippets
 | 
					- name: Copy snippets
 | 
				
			||||||
  template:
 | 
					  template:
 | 
				
			||||||
    src: nginx/snippets/options-ssl.conf.j2
 | 
					    src: "nginx/snippets/{{ item }}.j2"
 | 
				
			||||||
    dest: /etc/nginx/snippets/options-ssl.conf
 | 
					    dest: "/etc/nginx/snippets/{{ item }}"
 | 
				
			||||||
 | 
					  loop:
 | 
				
			||||||
 | 
					    - options-ssl.conf
 | 
				
			||||||
 | 
					    - options-proxypass.conf
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- name: Copy dhparam
 | 
					- name: Copy dhparam
 | 
				
			||||||
  template:
 | 
					  template:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,12 @@
 | 
				
			||||||
{{ ansible_header | comment }}
 | 
					{{ ansible_header | comment }}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Automatic Connection header for WebSocket support
 | 
				
			||||||
 | 
					# See http://nginx.org/en/docs/http/websocket.html
 | 
				
			||||||
 | 
					map $http_upgrade $connection_upgrade {
 | 
				
			||||||
 | 
					    default upgrade;
 | 
				
			||||||
 | 
					    ''      close;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
{% for site in nginx.reverseproxy_sites %}
 | 
					{% for site in nginx.reverseproxy_sites %}
 | 
				
			||||||
# Redirect http://{{ site.from }} to https://{{ site.from }}
 | 
					# Redirect http://{{ site.from }} to https://{{ site.from }}
 | 
				
			||||||
server {
 | 
					server {
 | 
				
			||||||
| 
						 | 
					@ -41,12 +48,8 @@ server {
 | 
				
			||||||
    real_ip_header P-Real-Ip;
 | 
					    real_ip_header P-Real-Ip;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    location / {
 | 
					    location / {
 | 
				
			||||||
        proxy_set_header Host {{ site.from }};
 | 
					 | 
				
			||||||
        proxy_set_header P-Real-IP $remote_addr;
 | 
					 | 
				
			||||||
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 | 
					 | 
				
			||||||
        proxy_set_header X-Forwarded-Proto https;
 | 
					 | 
				
			||||||
        proxy_redirect off;
 | 
					 | 
				
			||||||
        proxy_pass http://{{ site.to }};
 | 
					        proxy_pass http://{{ site.to }};
 | 
				
			||||||
 | 
					        include "/etc/nginx/snippets/options-proxypass.conf";
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,17 @@
 | 
				
			||||||
 | 
					{{ ansible_header | comment }}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					proxy_redirect off;
 | 
				
			||||||
 | 
					proxy_set_header Host $host;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Pass the real client IP
 | 
				
			||||||
 | 
					proxy_set_header X-Real-IP $remote_addr;
 | 
				
			||||||
 | 
					proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Tell proxified server that we are HTTPS, fix Wordpress
 | 
				
			||||||
 | 
					proxy_set_header X-Forwarded-Proto https;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# WebSocket support
 | 
				
			||||||
 | 
					proxy_http_version 1.1;
 | 
				
			||||||
 | 
					proxy_set_header Upgrade $http_upgrade;
 | 
				
			||||||
 | 
					proxy_set_header Connection $connection_upgrade;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue