Mopidy, nginx configuration doesn't support websockets

A yunohost installation has been running successfully on my raspberry 4 for some months.
Now I wanted to install the music server mopidy.

Mopidy is supposed to play music from different sources locally on the raspi.
That means loudspeakers are connected to the raspberry. The songs to be played can be selected with mopidy’s webui on my laptop connected to the same local network.
For this purpose mopidy comes with it’s own HTTP-server, which by default listens on port 6680 and expects an URI-path “/musicbox_webclient” to open a webui. Another URI-path “/mopidy/ws” is then used to establish a websocket connection.

There is already a yunohost app for mopidy, but it has no maintainer and it doesn’t work either.
The proposed nginx-configuration in particular seems to be insufficient.
Instead, I use the following configuration that I found with google’s help.

location ^~ /musicbox {
    return 301 $scheme://$host/musicbox_webclient;

location ^~ /musicbox_webclient {
    proxy_pass           http://localhost:6680;
    proxy_http_version   1.1;
    proxy_set_header     Host $host;  

location ^~ /mopidy {
    proxy_pass http://localhost:6680;
    proxy_http_version 1.1;
    proxy_set_header     Host $host;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
    proxy_read_timeout 604800;
    proxy_send_timeout 604800;

This configuration works with a “normal” nginx-proxy, but not for yunohost!

Since I don’t understand the details of yunohost’s nginx-configuration, I can only describe what I’ve observed:

Within the nginx configuration there is a file for my domain, /etc/nginx/conf.d/
The block for the HTTPS server is defined in this file. And in the server block there is by default a line
“access_by_lua_file /usr/share/ssowat/access.lua;”

If I comment out this line, my server’s configuration works. I.e :
After entering the URL I see on the developer console of my browser some requests to this URL (…) that generate the webui.

This is followed by another request (wss:// to establish the websocket connection, which is answered with a status of 101 (Switching Protocols).
And everything works fine!

Of course the server won’t work at all without “access_by_lua_file”, so that’s not a solution.
But when I activate access_by_lua_file, the request to establish the websocket connection is rejected. On the developer console I see the status 302 (moved temporarely to
And mopidy’s webui repeats the last wss-requeat periodicaly - without success.

I have the impression that my configuration is fundamentally wrong or that I have forgotten something in the installation script.
In any case, I can’t get any further without help.
Therefore I would like to thank you for every hint.