Web Socket Connection Failed

We have hosted jupyter hub in our web application using iframe. For reverse proxy we have used nginx. The desired notebook is getting opened using the pre generated token. But the web socket connection is failed.
Following is the error for the web socket WebSocket connection to 'wss://url/user/username/api/kernels/7bc4a4e6-19d2-4de6-8640-2ea3a9c31237/channels?session_id=dc4f7727-c7c7-40ba-81d2-14a33221956a' failed:

Following is the nginx configuration:

location / {
       proxy_pass http://jupyterhub; # my existing apache instance
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Proto $proxy_add_x_forwarded_for;
        proxy_set_header Access-Control-Allow-Origin '*';
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_hide_header Content-Security-Policy;
        proxy_set_header Content-Security-Policy "frame-ancestors 'self' http://localhost:4200;";
        proxy_cookie_path / "/; SameSite=None";
        # re-write redirects to http as to https, example: /home
        proxy_redirect http:// https://;
    }

Does the everything work if you connect to JupyterHub directly, without an iframe? This will help to narrow down the problem.

Yes, without iframe it works fine in the browser.
Update: the another error for the above issue is as follows:

Indicate whether to send a cookie in a cross-site request by specifying its SameSite attribute

We have configured the same in jupyter hub config as well as jupyter notebook config, as follows:

c.NotebookApp.tornado_settings = {
    "headers": {
        "Content-Security-Policy": "frame-ancestors 'self' http://localhost:4200",
        "Access-Control-Allow-Origin": "http://localhost:4200",
    },
    'cookie_options': {'SameSite': 'None', 'Secure': True}
}

c.JupyterHub.tornado_settings = {
    "headers": {
        "Content-Security-Policy": "frame-ancestors 'self' http://localhost:4200",
        "Access-Control-Allow-Origin": "http://localhost:4200",
    },
    'cookie_options': {'SameSite': 'None', 'Secure': True}
}

But the error persists. In nginx also we set the Set_Cookie options as SameSite=None and secure

The issue is raised in chrome.

I have read on discourse to upgrade the python version the docker image to 3.8. Will try this solution and update here.