Caldav and carddav error resolving

hi all,

i have this problem in my overview -

Your web server is not properly set up to resolve “/.well-known/caldav”. Further information can be found in the documentation.

where do i add these lines in -

Redirect 301 /.well-known/carddav /nextcloud/remote.php/dav
Redirect 301 /.well-known/caldav /nextcloud/remote.php/dav

do i add it in “var/www/html/.htaccess” ie my root web server not my nextcloud instance ie “var/www/html/nextcloud/.htaccess”?

many thanks,
rob

Per the documentation, you add them to your .htaccess file, It would be in the root of your Nextcloud instance.

ok so i guess i edit the file - “/var/www/html/nextcloud/.htaccess”

RewriteRule ^Redirect 301 /.well-known/carddav /nextcloud/remote.php/dav [R=301,L]
RewriteRule ^Redirect 301 /.well-known/caldav /nextcloud/remote.php/dav [R=301,L]

is that correct

i have this in my .htaccess:

<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/host-meta /public.php?service=host-meta [QSA,L]
  RewriteRule ^\.well-known/host-meta\.json /public.php?service=host-meta-json [QSA,L]
  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]
  RewriteCond %{REQUEST_URI} !^/\.well-known/(acme-challenge|pki-validation)/.*
  RewriteRule ^(?:\.|autotest|occ|issue|indie|db_|console).* - [R=404,L]
</IfModule>

and in my overview i can still see the error :

There are some warnings regarding your setup.

* Your web server is not properly set up to resolve "/.well-known/caldav". Further information can be found in the [documentation](https://docs.nextcloud.com/server/14/go.php?to=admin-setup-well-known-URL).
* Your web server is not properly set up to resolve "/.well-known/carddav". Further information can be found in the [documentation](https://docs.nextcloud.com/server/14/go.php?to=admin-setup-well-known-URL).

i tried add the lines bellow to my .htaccess and i have commented the ones above and my nextcloud isn’t working anymore:

RewriteRule ^Redirect 301 /.well-known/carddav /nextcloud/remote.php/dav [R=301,L]
RewriteRule ^Redirect 301 /.well-known/caldav /nextcloud/remote.php/dav [R=301,L]

what am i doing wrong ?

You have two possibilities:

  • Using redirect rules from mod_alias, as in OT, to let the clients send a new requests to the redirects address/path.
  • Using rewrite rules from mod_rewrite, handling the path adjustment silently server side without new client requests, as suggested in the follow up answers.

I don’t know much about pros/cons, the first solution seems a bid simpler though.
But each of them need to be set inside your webserver or vhost config, as long add Nextcloud is not already your webroot. How should otherwise the server know about requests/redirects if the related rules ate in a sub directory .htaccess where it’s not yet inside :slightly_smiling_face:.

For the same reason the default .htaccess inside Nextcloud directory does not have any effect. It just works with Nextcloud add webroot, pointing to the then correct relative path without /nextcloud subdir inside.

sorted,

you add it in “/etc/httpd/conf.d/ssl.conf”, make sure its inbetween your virtualhost lines -

Redirect 301 /.well-known/carddav /nextcloud/remote.php/dav
Redirect 301 /.well-known/caldav /nextcloud/remote.php/dav

1 Like

hello @robertkwild
i have a same problem but i dont have a ssl.conf file ;-(

i have done - but still it is not working with caldav to sync

>vi /var/www/html/nextcloud/.htaccess
81 #### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####
82 Redirect 301 /.well-known/carddav /nextcloud/remote.php/dav
83 Redirect 301 /.well-known/caldav /nextcloud/remote.php/dav
84
85 ErrorDocument 403 //
86 ErrorDocument 404 //

I had the same problem and @robertkwild 's solution worked (many thanks!)

However, like @vinc, I don’t have /etc/httpd/conf.d/ssl.conf so instead, I opened my /etc/apache2/sites-enabled/default-ssl.conf and added the two lines

Redirect 301 /.well-known/carddav /nextcloud/remote.php/dav
Redirect 301 /.well-known/caldav /nextcloud/remote.php/dav

below the <VirtualHost>...</VirtualHost> section (but above </IfModule>).

Although this works and I don’t get the warnings anymore, I don’t understand at all why it works. I would appreciate any hints why the lines work in this place and not in the nextcloud.conf or any .htaccess file in /var/www/html or /var/www/nextcloud like the documentation suggests…

9 Likes

I don’t have a httpd folder in my etc folder like mable but I’m also not running apache. I am running nginx. I tried checking out the ssl.conf for my nginx settings but when I add the extra lines it makes it so that my nginx won’t start or restart.

I tried adding it to etc/nginx/sites-enabled/cloud.jackalope.tech (that’s the name of my cloud server) and restarted but I’m still getting the same caldav related error codes in the web portal

I fixed this issue and now I’m getting it again when trying to update to NC 17… very annoying this keeps popping up. I have no clue why it’s happening. I’m nearing the point where I think I might just try wiping this server and starting over. Doing so would be very annoying though and I’m not looking forward to the prospect.

It works fine for me. Many thanks!

That is working for me :slight_smile:
Thanks

I too am seeing “Your web server is not properly set up to resolve…” for /.well-known/carddav and /.well-known/caldav.

My Nextcloud 19 instance is also in a subdirectory in the web server document root directory:
<web_server_doc_root>/nextcloud

The only Apache config file I can change is .htaccess. Here’s my <web_server_doc_root>/.htaccess:

Redirect 301 /.well-known/carddav /nextcloud/remote.php/dav
Redirect 301 /.well-known/caldav /nextcloud/remote.php/dav    
<IfModule mod_rewrite.c>
      RewriteEngine on
      RewriteRule ^\.well-known/host-meta /nextcloud/public.php?service=host-meta [QSA,L]
      RewriteRule ^\.well-known/host-meta\.json /nextcloud/public.php?service=host-meta-json [QSA,L]
      RewriteRule ^\.well-known/webfinger /nextcloud/public.php?service=webfinger [QSA,L]
      RewriteRule ^\.well-known/nodeinfo /nextcloud/public.php?service=nodeinfo [QSA,L]
      RewriteRule ^\.well-known/carddav /nextcloud/remote.php/dav/ [R=301,L]
      RewriteRule ^\.well-known/caldav /nextcloud/remote.php/dav/ [R=301,L]
</IfModule>
<IfModule mod_headers.c>
      Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
</IfModule>

:disappointed:

Update:
The lines beginning with “Redirect 301 …” are not needed. Those redirects are already defined as RedirectRules:

          RewriteRule ^\.well-known/carddav /nextcloud/remote.php/dav/ [R=301,L]
          RewriteRule ^\.well-known/caldav /nextcloud/remote.php/dav/ [R=301,L]

URLs https://example.com/.well-known/caldav and https://example.com/.well-known/carddav do get redirected to https://example.com/nc/remote.php/dav/, and I’ve been able to connect to CalDAV and CardDAV from my Android device. I’m therefore ignoring the “… not properly set up to resolve …” error messages.

For some reason the documentation in https://docs.nextcloud.com/server/19/admin_manual/issues/general_troubleshooting.html#service-discovery
does not work with my 19.0.3 installation.
Tried modified .htaccess in /var/www/html and in /var/www/html/nextcloud with no success.
This one worked with adding the redirect to /etc/apache2/sites-enabled/000-default-le-ssl.conf
Thank you for the hint

Hi,

This seems to be a very annoying and unresolved “issue” for a long time.
The issue is not in any of your config files at all, it is in the apache configuration.

In the section defining the directory where your nextcloud installation resides, please make sure that the following options match:

DocumentRoot "/path/to/nextcloud"
<Directory /path/to/nextcloud>
  Require all granted
  AllowOverride All
  Options FollowSymLinks MultiViews

  <IfModule mod_dav.c>
    Dav off
  </IfModule>
</Directory>

If AllowOverride is not set this way, it prevents other configuration files from overriding the options as set by apache, which would prevent .htaccess from working as expected.
This could either be in the httpd.conf file, or a virtual host file, depending on your setup.

This is what it would look like in the httpd.conf file, in the DocumentRoot - your configuration may vary.

-G

1 Like

Thank you. This worked for me too. My file in /etc/apache2/sites-enabled/ was called “000-default-le-ssl.conf”.

@gibikha

You hit the nail on the head for me!