Terminal glitch where commands are repeatedly displayed

Hello,

I installed jupyterhub on our platform for our end users to have a web ssh access to the servers of the cluster (Azure). Jupyterhub is installed on one server and is exposed through a web portal (nginx) hosted on another server.
The service works, the users are able to connect to it and open ssh terminals. We observe a strange glitch where shell commands are displayed repeatedly in the terminal. The issue is reproduced with any command and in multiple browsers.
After some investigations, it seems to be some kind of display issue - the repeated commands are not executed (they do not appear in the history). I can see in the browser developer console that there is a repeated call to /jupyterhub/user/admin/terminals/websocket/1 URI which coincide with when the commands are repeated on the screen.
Also I can see in the nginx logs the call to the websocket:
“GET /jupyterhub/user/admin/terminals/websocket/1 HTTP/1.1” 101 1936 “-” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36”

Do you have an idea on how we could fix this issue or how could we continue the troubleshooting ?

Thanks in advance, I hope it is clear enough.

For the nginx configuration, I followed this page: Using a reverse proxy — JupyterHub documentation
Here is the jupyterhub and nginx configuration:

jupyterhub_config.py

c.JupyterHub.extra_log_file = ‘/var/log/jupyterhub/jupyterhub.log’
c.JupyterHub.pid_file = ‘/opt/jupyterhub/jupyterhub.pid’
c.JupyterHub.cookie_secret_file = ‘/opt/jupyterhub/jupyterhub_cookie_secret’
c.JupyterHub.bind_url = ‘http://127.0.0.1:8000’
c.JupyterHub.base_url = ‘/jupyterhub/’
c.Authenticator.allow_all = True
c.NotebookApp.max_upload_size = 256

import os
import subprocess
def create_dir_hook(spawner):
  username = spawner.user.name
  if not os.path.exists(os.path.join(‘/volumes/jupyterhub’, username)):
    subprocess.call([“sudo”, “/sbin/mkhomedir_helper”, spawner.user.name])

c.Spawner.pre_spawn_hook = create_dir_hook

nginx.conf

map $http_upgrade $connection_upgrade {
  default upgrade;
  ‘’ close;
}

server {
  listen 80;
  server_name server_name  testbrieuc-portal.bigdata.fr.intraorange testbrieuc-vrp001.data.testbrieuc 172.16.164.129;

  # Redirect the request to HTTPS
  return 302 https://$host$request_uri;
}

server {
  listen         443 ssl;
  add_header Strict-Transport-Security “max-age=31536000; includeSubDomains”   always;
  ssl_protocols TLSv1.2;
  ssl_certificate       /etc/nginx/ssl/web_portal.crt;
  ssl_certificate_key   /etc/nginx/ssl/web_portal.key;

  root         /usr/share/nginx/html/portal;
  server_name  testbrieuc-portal.bigdata.fr.intraorange testbrieuc-vrp001.data.testbrieuc 172.16.164.129;
  access_log /var/log/nginx/portal.access.log;
  error_log /var/log/nginx/portal.error.log;

  include /etc/nginx/conf.d/services/*.conf;
}

jupyterhub_nginx.conf

location /jupyterhub/ {
  proxy_pass http://lb-jupyterhub.data.testbrieuc:8000/jupyterhub/;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header Host $http_host;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

  # websocket headers
  proxy_http_version 1.1;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection $connection_upgrade;
  proxy_set_header X-Scheme $scheme;

  proxy_buffering off;
}

Here is what we installed for jupyter:

apt install nodejs,npm,python3-pip
pip3 install jupyter,jupyterhub
npm install configurable-http-proxy

Ubuntu 20.04.6 LTS (Focal Fossa)

pip3 list
jupyter                   1.1.1
jupyter-client            8.6.3
jupyter-console           6.6.3
jupyter-core              5.8.1
jupyter-events            0.10.0
jupyter-lsp               2.3.0
jupyter-server            2.14.2
jupyter-server-terminals  0.5.3
jupyterhub                5.4.2
jupyterlab                4.3.8
jupyterlab-pygments       0.3.0
jupyterlab-server         2.28.0
jupyterlab-widgets        3.0.16
notebook                  7.4.7
notebook-shim             0.2.4

npm						  11.6.2
node					  v24.12.0

Thanks.