Moving from Traefik 2 to Traefik 3 gives .well-known error

I am running Nextcloud (30.0.4) in docker compose on an Ubuntu 22.04 VM running on my TrueNAS Scale. As a reverse proxy I use Traefik 2.9. Everything works fine. But in an attempt to keep up to date, I am trying to upgrade to Traefik 3. So, when I change my traefik tag from traefik:2.9 to traefik:latest, I get thiss error:

Your web server is not properly set up to resolve .well-known URLs, failed on: /.well-known/caldav

If I enter
https://cloud.example.com/.well-known/caldav
it seems to work fine, and it takes me to https://cloud.example.com/remote.php/dav/.
But I´d like to get rid of the error.
Looking at .htaccess inside my Nextcloud container, I find this block:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} DavClnt
RewriteRule ^$ /remote.php/webdav/ [L,R=302]
RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteRule ^\.well-known/carddav /remote.php/dav/ [R=301,L]
RewriteRule ^\.well-known/caldav /remote.php/dav/ [R=301,L]
RewriteRule ^remote/(.*) remote.php [QSA,L]
RewriteRule ^(?:build|tests|config|lib|3rdparty|templates)/.* - [R=404,L]
RewriteRule ^\.well-known/(?!acme-challenge|pki-validation) /index.php [QSA,L]
RewriteRule ^ocm-provider/?$ index.php [QSA,L]
RewriteRule ^(?:\.(?!well-known)|autotest|occ|issue|indie|db_|console).* - [R=404,L]
</IfModule>

Is that not correct? Does it need to be modified somehow? I would like to keep all my configuration in the docker compose file, is it possible to modify from there if needed?

I did find and try these labels in my nextcloud container:

- "traefik.http.middlewares.nextcloud-dav.redirectregex.regex=^/.well-known/ca(l|rd)dav"
- "traefik.http.middlewares.nextcloud-dav.redirectregex.replacement=https://cloud.example.com/remote.php/dav/"
- "traefik.http.middlewares.nextcloud-dav.redirectregex.permanent=true"

That didn´t help. And .htaccess remains the same. Does someone knpw how to solve this? Here the complete list of labels for my Nextcloud container:



- "traefik.enable=true"
- "traefik.http.routers.nextcloud.rule=Host(`${NEXTCLOUD_HOSTNAME}`)"
- "traefik.http.routers.nextcloud.service=nextcloud"
- "traefik.http.routers.nextcloud.entrypoints=websecure"
- "traefik.http.services.nextcloud.loadbalancer.server.port=80"
- "traefik.http.routers.nextcloud.tls=true"
- "traefik.http.routers.nextcloud.tls.certresolver=letsencrypt"
- "traefik.http.services.nextcloud.loadbalancer.passhostheader=true"
- "traefik.docker.network=traefik-network"

#Middlerwares
- "traefik.http.routers.nextcloud.middlewares=limit@docker,nextcloudHeader,compresstraefik" #adds limit and headers MWs to router in Traefik,  
#Compress
- "traefik.http.middlewares.compresstraefik.compress=true"      
#HSTS
- "traefik.http.middlewares.nextcloudHeader.headers.stsSeconds=15552000"
- "traefik.http.middlewares.nextcloudHeader.headers.stsIncludeSubdomains=true"
- "traefik.http.middlewares.nextcloudHeader.headers.stsPreload=true"
- "traefik.http.middlewares.nextcloudHeader.headers.forceSTSHeader=true"
#Buffering
- "traefik.http.middlewares.limit.buffering.maxRequestBodyBytes=10737418240"
- "traefik.http.middlewares.limit.buffering.memRequestBodyBytes=50000000"   #200000000
- "traefik.http.middlewares.limit.buffering.memResponseBodyBytes=50000000"
#DAV
- "traefik.http.middlewares.nextcloud-dav.redirectregex.regex=^/.well-known/ca(l|rd)dav"
- "traefik.http.middlewares.nextcloud-dav.redirectregex.replacement=https://cloud.example.com/remote.php/dav/"
- "traefik.http.middlewares.nextcloud-dav.redirectregex.permanent=true"

I’m not sure how that ever worked. You would have needed this in Traefik 2.x too. The syntax is not correct, however.

See:

Thank you for responding and pointing me in the right direction. Sorry about the delay in feedback, got held up a few days by the holiday. Kids and whatnot… :slight_smile:

However, you solved my problem. Read through the articles you sent, and found the answer in the “Reverse proxy” one.

Ended up changing my dav labels to:

      - "traefik.http.middlewares.nextcloud-dav.redirectregex.regex=https://(.*)/.well-known/(?:card|cal)dav"
      - "traefik.http.middlewares.nextcloud-dav.redirectregex.replacement=https://cloud.example.com/remote.php/dav/"
      - "traefik.http.middlewares.nextcloud-dav.redirectregex.permanent=true"

And the error I had is no more. Again, thank you!

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.