Warning Your web server is not properly set up to resolve "/.well-known/caldav"

Hello,
I have nc 16.0.6 in a subfolder /cloud and have the warning massage:

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

I have read in the documentation, that - by subfolder - I must change the value in my .httaccess file in the nc root folder:

> <IfModule mod_rewrite.c>
>   RewriteEngine on
>   RewriteCond %{HTTP_USER_AGENT}  DavClnt
>   RewriteRule ^$         /cloud/remote.php/webdav/          [L,R=302]
>   RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
>   RewriteRule ^\.well-known/host-meta /cloud/public.php?service=host-meta [QSA,L]
>   RewriteRule ^\.well-known/host-meta\.json /cloud/public.php?service=host-meta-json [QSA,L]
>   RewriteRule ^\.well-known/webfinger /cloud/public.php?service=webfinger [QSA,L]
>   RewriteRule ^\.well-known/carddav /cloud/remote.php/dav/ [R=301,L]
>   RewriteRule ^\.well-known/caldav /cloud/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>

But the warnings occured also in the admin panel.
Have everybody an hint why?
Thank you!
Michael

That is not what they say:

If your Nextcloud instance is installed in a subfolder called nextcloud and you’re running Apache create or edit the .htaccess file within the document root of your Web server and add the following lines

So the difference: nc root folder ≠ document root of your webserver…

Hi … I had the same problem and what I did to fix it is to remove the subfolder from the path …

try this:

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/webfinger /public.php?service=webfinger [QSA,L]
>   RewriteRule ^\.well-known/carddav /remote.php/dav/ [R=301,L]
>   RewriteRule ^\.well-known/caldav /remote.php/dav/ [R=301,L]

I wait it work for you.
Greetings.

Hello,

I have now tried all combinations:

  • with subfolder “cloud” in .htaccess in the nc root (/var/www/html/cloud) and document root (/media/fc_daten) and
  • without subfolder “cloud” in both .htaccess

In no combination does the warning disappear in the admin panel.
I do not know, what I can now test.
Thank’s
Michael

Hi @Michael2222,

I‘m sorry if my original post was too short…because:

Is NOT „the document root of your Web server“.

The root document root of your webserver is probably: /var/www/html
Are you running an apache webserver?
what do you see if you browse to your ip/ or URL without the subfolder (cloud)?

These questions just to be sure, but probably: just put the .htaccess file under /var/www/html/

Best, Bernd

Hello,

Ahh, document root is not equal data root for nextcloud.

Yes

The standard page from apache2: Apache2 Ubuntu Default Page -> “It works!”

Here now the three .htaccess in my nextcloud installation:

/var/www/html/.htaccess - webserver document root

RewriteEngine on
RewriteRule ^.well-known/host-meta /cloud/public.php?service=host-meta [QSA,L]
RewriteRule ^.well-known/host-meta.json /cloud/public.php?service=host-meta-json [QSA,L]
RewriteRule ^.well-known/webfinger /cloud/public.php?service=webfinger [QSA,L]
RewriteRule ^.well-known/carddav /cloud/remote.php/dav/ [R=301,L]
RewriteRule ^.well-known/caldav /cloud/remote.php/dav/ [R=301,L]

/var/www/html/cloud/.htaccess - nextcloud root

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/webfinger /public.php?service=webfinger [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]

/media/fc_daten/.htaccess - data root from nextcloud
# Generated by Nextcloud on 2019-11-08 21:21:50
# line below if for Apache 2.4

Require all denied

# line below if for Apache 2.2
<ifModule !mod_authz_core.c>
deny from all
Satisfy All
</ifModule>

# section for Apache 2.2 and 2.4
<ifModule mod_autoindex.c>
IndexIgnore *
</ifModule>

But still the warnings:
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/16/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/16/go.php?to=admin-setup-well-known-URL)

Thank’s
Michael

So the first one (/var/www/html/.htaccess) seams to be fine.

( What does those rewriterules do? They point devices that search the webserver (root of the webserver, the URL without subfolder) for well known services like cal- and carddav to the right place. )

Second /var/www/html/cloud/.htaccess :
I would delete the 5 lines that start with RewriteRule that are already in the one above.

The third one should be fine.

I don‘t know if a server restart is necessary - I would do it anyway
sudo systemctl restart apache2

I have delete this five lines.

I have restart the webserver -> same warnings.
Then I have reboot the whole server -> same warnings

It is possible to check the new setting from outside? Perhaps the warnings are wrong and the system works fine?

Regards
Michael

you can test it with wget <ip-address>/.well-known/caldav and see some redirections. “Outside” could even be a ubuntu terminal/shell. But I don’t think the test is wrong.

That one is a tricky one… As it sure is not certain, that you need the function those rewrite-rules give to you… You don’t have problems on “the system” but with probably attached computers/mob-phones… that would be: problems setting up calendar and contact apps. (So: problems elsewhere and the fix on “the system”)

But something else - there are more requirements for this .htaccess files to work. If you like documentation - well Apache HTTP Server is a tough one :wink: - look here: https://httpd.apache.org/docs/current/howto/htaccess.html
Navigate to the botton to the troubleshooting section and read:

When you put configuration directives in a .htaccess file, and you don’t get the desired effect, there are a number of things that may be going wrong.
Most commonly, the problem is that AllowOverride is not set such that your configuration directives are being honored. Make sure that you don’t have a AllowOverride None in effect for the file scope in question. A good test for this is to put garbage in your .htaccess file and reload the page. If a server error is not generated, then you almost certainly have AllowOverride None in effect.

I like that test! :slight_smile: tried with coffee leftover, banana peel etc. - didn’t work :upside_down_face:

That sentence: " Make sure that you don’t have a AllowOverride None in effect" … That is not trivial: you have to look at least in /etc/apache2/apache2.conf and all the files in or under /etc/apache2/sites-enabled/

Another edit: The documentation says

there are a number of things that may be going wrong

Well that is so reassuring. So there are after a certain time some questions:

  • is the sun shining? And should I go out for a walk?
  • do I need this subfolder? That is: will I run anything else than nextcloud on this webserver? Perhaps I could go then with the answer of @magber68 (if I understood that correctly) -> the problem then would be different then: how to change the “document root” in the apache configs - or how to setup a good vhost-file for apache. But I think this is much better documented in nextcloud docs then the few words for troubleshooting this redirect issue.
  • do I want to learn more about this patchy webserver? Solve false problems and learn something rather than avoid problems and learn little :nerd_face:

Best, Bernd