From 11956baae931847e49ef4711befdc354fb08659b Mon Sep 17 00:00:00 2001
From: Stefano Alberto Russo <stefano.russo@gmail.com>
Date: Sun, 6 Apr 2025 23:59:34 +0200
Subject: [PATCH] Added a redirect in the proxy to workaround that JS request
 cannot be constructed from a URL that includes credentials.

---
 services/webapp/code/rosetta/core_app/utils.py | 2 ++
 services/webapp/code/rosetta/core_app/views.py | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/services/webapp/code/rosetta/core_app/utils.py b/services/webapp/code/rosetta/core_app/utils.py
index dc4a44c..7879e4a 100644
--- a/services/webapp/code/rosetta/core_app/utils.py
+++ b/services/webapp/code/rosetta/core_app/utils.py
@@ -725,6 +725,8 @@ Listen '''+str(task.tcp_tunnel_port)+'''
       AuthUserFile /shared/etc_apache2_sites_enabled/'''+str(task.uuid)+'''.htpasswd
       Require valid-user
 
+      Redirect "/d6f70e5c-a2a9-47fc-9b9c-25e32ab1ec27" "/"
+
       # preserve Host header to avoid cross-origin problems
       ProxyPreserveHost on
       # proxy to the port
diff --git a/services/webapp/code/rosetta/core_app/views.py b/services/webapp/code/rosetta/core_app/views.py
index c2a2516..67c9d19 100644
--- a/services/webapp/code/rosetta/core_app/views.py
+++ b/services/webapp/code/rosetta/core_app/views.py
@@ -1224,7 +1224,7 @@ def direct_connection_handler(request, uuid):
         if task.requires_proxy_auth and task.auth_token and not task.container.disable_http_basicauth_embedding:
             user = request.user.email
             password = task.auth_token
-            redirect_string = 'https://{}:{}@{}:{}'.format(user, password, rosetta_tasks_proxy_host, task.tcp_tunnel_port)
+            redirect_string = 'https://{}:{}@{}:{}/d6f70e5c-a2a9-47fc-9b9c-25e32ab1ec27'.format(user, password, rosetta_tasks_proxy_host, task.tcp_tunnel_port)
         else:
             redirect_string = 'https://{}:{}'.format(rosetta_tasks_proxy_host, task.tcp_tunnel_port)
     else:
-- 
GitLab