Docker Nextcloud + Synology reverse proxy: dav issues

In a small machine, I have installed Ubuntu server, docker and portainer.
I use the official nextcloud and mariadb images. For the reverse proxy, I use the Synology reverse system.
Everything is fine, ssl is provided by tue Syno (with personnal official ssl certs) except caldav & carddav. I have tried some ideas found in that forum (some tunes inside .htaccess)

RewriteRule ^\.well-known/carddav https://%{SERVER_NAME}/remote.php/dav/ [R=301,L]
RewriteRule ^\.well-known/caldav https://%{SERVER_NAME}/remote.php/dav/ [R=301,L]

but they don’t work.
I have no ideas anymore so I’m asking you some help.
Thank you

You don’t need any ReWrite Conditions? Usually I’m accustomed to seeing something like this (this is purely a random example)

{REQUEST_URI} ^/api/v1/websocket [NC,OR]
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC,OR]
RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
RewriteRule .* ws://{REQUEST_URI}

Maybe. I will try this evening, replacing the port number from your proposal

I have tried, it didn’t work. I am currently using DAVX5 on Android. And I found a solution.

In a normal installation of nextcloud ( classic LAMP) the url was

With the docker installation, I only modified the url like this:

Now my phone can sync with nextcloud.

My issue seems to be solved…