Using AWS ELB, I was able to serve HTTP (via uwsgi) and websockets through Nginx with Nginx handling the SSL certs.
Once I tried to offloading SSL certs to the ELB so I could capture X-Forwarded-For, websockets fail to route/upgrade to Daphne and I get "Not Found: /ws/" in uwsgi's logs.
Here is the relevant (working) piece of Nginx .conf file using TCP/443 pass thru from the ELB:
location /ws {
proxy_pass http://unix:/opt/toogo/run/
r117.0.4.3720.ws; #Obviously daphne is listening here
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
}
What change is required if I offload the SSL certs to the ELB and introduce X-Forwarded-for?