disable http auth for websockets

This commit is contained in:
j3d1 2023-11-22 22:37:56 +01:00
parent c88d434f39
commit e45a1f271e
4 changed files with 22 additions and 5 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

@ -1,10 +1,14 @@
aiosmtpd==1.4.4.post2
asgi-redis
anyio==4.0.0
asgiref==3.7.2
async-timeout==4.0.3
atpublic==4.0
attrs==23.1.0
channels
certifi==2023.11.17
channels==4.0.0
channels-redis==4.1.0
charset-normalizer==3.3.2
click==8.1.7
coreapi==2.3.3
coreschema==0.0.4
coverage==7.3.2
@ -13,10 +17,14 @@ django-extensions==3.2.3
django-soft-delete==0.9.21
djangorestframework==3.14.0
drf-yasg==1.21.7
h11==0.14.0
httptools==0.6.1
idna==3.4
inflection==0.5.1
itypes==1.2.0
Jinja2==3.1.2
MarkupSafe==2.1.3
msgpack==1.0.7
msgpack-python==0.5.6
openapi-codec==1.3.2
packaging==23.2
@ -24,11 +32,12 @@ Pillow==10.1.0
python-dotenv==1.0.0
pytz==2023.3.post1
PyYAML==6.0.1
redis
redis==5.0.1
requests==2.31.0
sdnotify==0.3.2
setproctitle==1.3.3
six==1.16.0
sniffio==1.3.0
sqlparse==0.4.4
typing_extensions==4.8.0
uritemplate==4.1.1

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);