Nginx reverse proxying from non root domain to docker

I got an instance running on my server and I can connect to it fine from the LAN, with the port that I set in docker-compose.yml, e.g. http:/192.168.1.22:8111

Now I would like to reach it from the outside, so I am playing with the system nginx, with the hope of being able to leave untouched everything in the container, including the internal nginx.

I do not want to register a new dns, so I am looking to reach the instance at a subdir: my.domain/seafile.

I tried to add this into my nginx config:

...
proxy_set_header X-Forwarded-For $remote_addr;
location /seafile {
     rewrite ^/seafile/(.*) $1 break; 
     proxy_pass         http://127.0.0.1:8111;
     proxy_set_header   Host $host;
     proxy_set_header   X-Real-IP $remote_addr;
     proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
     proxy_set_header   X-Forwarded-Host $server_name;
     proxy_set_header   X-Forwarded-Proto $scheme;
     proxy_read_timeout  1200s;

     # used for view/edit office file via Office Online Server
     client_max_body_size 0;

     access_log      /var/log/nginx/seahub.access.log;
     error_log       /var/log/nginx/seahub.error.log;
}
...

But this is how the website loads:

The only relevant log that I managed to find is within the container:

cat /opt/seafile/logs/seahub.log
2023-03-04 19:50:02,484 [WARNING] django.request:224 log_response Not Found: /seafile

I’ve found a few similar topics but all seem quite outdated and I am not sure how to proceed. I have also found some hints in the manual, but no example for this specific application, so I am not sure about which nginx I should modify and how.

I will also need to setup seafhttp somehow I guess for the desktop clients to sync fine I guess… Is there a proper guide with the complete conf files somewhere?

Ok I made some progress. The rewrite posted above is incorrect and it wasn’t matching anything. The correct one should be:

rewrite /seafile/?(.*) /$1 break; 

now the matching take place and if I browse

https://my.domain.net/seafile

the request goes through and I get redirect to

https://my.domain.net/accounts/login/?next=/

…which however is just my homepage.
I believe that the response should be served at:

https://my.domain.net/seafile/accounts/login/?next=/

I need to figure out if there is some nginx directive that could help (subs_filter?) or if I am better messing with the seafile conf files.