disable http auth for websockets

This commit is contained in:
j3d1 2023-11-22 22:37:56 +01:00
parent c88d434f39
commit 79c31d6d22
3 changed files with 10 additions and 2 deletions

View file

@ -3,6 +3,6 @@ from django.urls import path
from .consumers import NotifyConsumer
websocket_urlpatterns = [
path('notify/<str:event_slug>/', NotifyConsumer.as_asgi()),
path('ws/notify/<str:event_slug>/', NotifyConsumer.as_asgi()),
]

View file

@ -24,6 +24,14 @@ server {
try_files $uri $uri/ /index.html;
}
location /ws {
proxy_http_version 1.1;
auth_basic off;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://c3lf-sys3;
}
location /api {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

View file

@ -35,7 +35,7 @@ export default {
}
},
created: function () {
this.notify_socket = new WebSocket('wss://' + window.location.host + '/notify/');
this.notify_socket = new WebSocket('wss://' + window.location.host + '/ws/notify/');
this.notify_socket.onmessage = (e) => {
let data = JSON.parse(e.data);
console.log(data, e.data);