From c2e498a5ea7f0a12bad894cb5c4916823a5779fe Mon Sep 17 00:00:00 2001 From: Chris Meyers Date: Mon, 12 Feb 2024 15:28:03 -0500 Subject: [PATCH] Allow connecting to websockets via api/websocket/ * Before, we just allowed websockets on /websocket/. With this change, they can now come from /api/websocket/ --- awx/main/routing.py | 1 + .../ansible/roles/sources/templates/nginx.locations.conf.j2 | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/awx/main/routing.py b/awx/main/routing.py index 9625b2317649..290e202afa7d 100644 --- a/awx/main/routing.py +++ b/awx/main/routing.py @@ -27,6 +27,7 @@ def __init__(self, *args, **kwargs): websocket_urlpatterns = [ + re_path(r'api/websocket/$', consumers.EventConsumer.as_asgi()), re_path(r'websocket/$', consumers.EventConsumer.as_asgi()), re_path(r'websocket/relay/$', consumers.RelayConsumer.as_asgi()), ] diff --git a/tools/docker-compose/ansible/roles/sources/templates/nginx.locations.conf.j2 b/tools/docker-compose/ansible/roles/sources/templates/nginx.locations.conf.j2 index ca82f92c5584..95c86cb9ee93 100644 --- a/tools/docker-compose/ansible/roles/sources/templates/nginx.locations.conf.j2 +++ b/tools/docker-compose/ansible/roles/sources/templates/nginx.locations.conf.j2 @@ -10,7 +10,7 @@ location {{ (ingress_path + '/favicon.ico').replace('//', '/') }} { alias /awx_devel/awx/public/static/favicon.ico; } -location {{ (ingress_path + '/websocket').replace('//', '/') }} { +location ~ ({{ (ingress_path + '/websocket').replace('//', '/') }}|{{ (ingress_path + '/api/websocket').replace('//', '/') }}) { # Pass request to the upstream alias proxy_pass http://daphne; # Require http version 1.1 to allow for upgrade requests