3
장고 채널 websocket은 내가 암호화 된 SSL을 설치할 때까지 AWS 서버에서 잘 작동했습니다. 다른 인증서를 시도했지만 wss가 작동하지 않습니다. 여기 andrewgodwin sugestions을 따라django channels behind https
https://django-channels-example.herokuapp.com/
:
daphne -b 0.0.0.0 vp.asgi:channel_layer --port 8000 -v 2
:
https://github.com/django/channels/issues/248
I 포트 8000에 다프네를 지적 나는 채널이 HTTPS를 뒤에 일 수 있음을 보여줍니다이 온라인 배포를 보았다
그리고 내 자바 스크립트에서 동일한 포트를 사용했습니다 :
chatsock = new WebSocket(ws_scheme + '://' + window.location.host + ":8000/chat");
내의 nginx의 구성 : //example.com : 8000/채팅
파이어 폭스 WSS에서 서버에 연결을 설정할 수 없습니다 :
server {
listen 80;
server_name mysite.com www.example.com;
return 301 https://www.example.com$request_uri;
}
server{
listen 443 ssl;
server_name mysite.com www.example.com;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
root /home/ubuntu/vp;
access_log /var/log/nginx/guni-access.log;
error_log /var/log/nginx/guni-error.log info;
location /wss/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-for $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_pass http://0.0.0.0:8000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location/{
proxy_pass http://0.0.0.0:8000;
proxy_set_header HOST $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-for $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
port_in_redirect off;
proxy_connect_timeout 300;
}
location ~ /.well-known {
allow all;
}
location /static/ {
alias /home/ubuntu/vp/static/;
expires 30d;
}
}
내 브라우저가 있음을 알려줍니다.
제안 사항? 감사합니다. .
아마이 서비스는 아직 제공되지 않습니다 만, 개발자는이에 대한 지원에 데려에 노력하고 있습니다. 자세한 내용은 다음을 참조하십시오. https://github.com/django/daphne/pull/36 https://github.com/django/daphne/issues/35 – JJK