map $http_upgrade $connection_upgrade { default upgrade; '' close; } server { listen 443; server_name rancher.{{ pillar['network']['domain'] }}; ssl_certificate /etc/rancher/ssl/rancher-server.crt; ssl_certificate_key /etc/rancher/ssl/rancher-server.key; location /{ proxy_pass https://localhost:9443; proxy_ssl_trusted_certificate /etc/rancher/ssl/rancher-server.crt; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Port $server_port; } } server { listen 80; server_name rancher.{{ pillar['network']['domain'] }}; return 301 https://rancher.{{ pillar['network']['domain'] }}$request_uri; }