Redirecting webfinger and nodeinfo for Nextcloud
How to setup a redirect for webfinger and nodeinfo in your server configuration to make Nextcloud stop complaining about it.

By. Jacob
Edited: 2021-03-23 09:15
- Your web server is not properly set up to resolve “/.well-known/webfinger”. Further information can be found in the documentation.
- Your web server is not properly set up to resolve “/.well-known/nodeinfo”. Further information can be found in the documentation.
After updating to Nextcloud 21 I started getting this interesting error on the overview page; but the linked page in the official documentation does not provide a solution.
It turns out there is an easy solution. In my case I simply had to add a couple of more redirects to my Apache VHOST configuration file; this can also be added to .htaccess, but I prefer to avoid that and just add it directly in the server configuration files. To fix the problem, try adding the following:
Redirect 301 /.well-known/webfinger /nextcloud/index.php/.well-known/webfinger
Redirect 301 /.well-known/nodeinfo /nextcloud/index.php/.well-known/nodeinfo
My redirect section for Nextcloud now looks like this:
# ---------------------
# Nextcloud stuff below
# ---------------------
Redirect 301 /.well-known/carddav /nextcloud/remote.php/dav
Redirect 301 /.well-known/caldav /nextcloud/remote.php/dav
Redirect 301 /.well-known/webfinger /nextcloud/index.php/.well-known/webfinger
Redirect 301 /.well-known/nodeinfo /nextcloud/index.php/.well-known/nodeinfo
This way I also avoid messing with mod_rewrite, which tends to have a somewhat exotic syntax compared with regular expressions in PHP; but I also dislike using it for stuff that does not really need regular expressions.
If you prefer using mod_rewrite, this should also work:
RewriteEngine on
RewriteRule ^.well-known/carddav /nextcloud/remote.php/dav/ [R=301,L]
RewriteRule ^.well-known/caldav /nextcloud/remote.php/dav/ [R=301,L]
RewriteRule ^.well-known/webfinger /nextcloud/index.php/.well-known/webfinger [R=301,L]
RewriteRule ^.well-known/nodeinfo /nextcloud/index.php/.well-known/nodeinfo [R=301,L]
Remember to reload your your configuration afterwards:
sudo service apache2 reload
Still having problems?
You should make sure to either restart or reload Apache:
sudo service apache2 reload
If it still does not work, make sure that your browser is not caching the HTTP responses. I had an issue with that.
To refresh the cache in your browser, you can open up developer tools and check the Disable Cache option; this will only apply while developer tools is open:

Then, while developer tools is open you just refresh the page, and the warning should go away.
Tell us what you think: