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: 2022-11-06 07:38
- 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:
Thanks for the hint! I had the same issue and I was able to fix it. The Nextcloud project is already [discussing this issue](https://github.com/nextcloud/documentation/issues/6157).
However, note that you'll have to escape the dot character in regular expressions. So, you would write `\.` instead of `.` Example:
```
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]
```
I know it is being discussed; I was one of the first to point it out and submit a patch to their documentation, but I guess it was not accepted. It was just a simple update to the documentation, but NC's process for contributing is just too complicated.
Thanks for posting this. As I use Apache with LetsEncrypt, I had to add the redirects to 000-default-le-ssl.conf. Errors are gone!
what if i'm using mariadb? i've tried to add to my .htaccess file but it's still there.
https://photos.app.goo.gl/mThsvLHGVmH5Vw7v7
Thanks for writing this blog post. This is the only solution I could find to make these warnings go away, using Apache + NextCloud.
I added the lines (below "My redirect section for Nextcloud now looks like this:") to the file /etc/apache2/sites-available/default-ssl.conf, right before the `</VirtualHost> ` part at the end.
Several hours of browsing and configuration came to an end 3minutes after I arrived here. Thank You!
And the below Redirect rule in your apache config file:
/etc/apache2/sites-available/xxxxx-ssl.conf
Redirect 301 /.well-known/carddav /remote.php/dav
Redirect 301 /.well-known/caldav /remote.php/dav
Redirect 301 /.well-known/webfinger /index.php/.well-known/webfinger
Redirect 301 /.well-known/nodeinfo /index.php/.well-known/nodeinfo
Thank you for writing this and thank you to Martin for commenting where the change needed to be if using Lets Encrypt (which I am). I have been working relentlessly on this for hours, and, once I came across this post, problem solved!
Thanks again!
Thank you for the "If it still does not work, make sure that your browser is not caching the HTTP responses. I had an issue with that."
This works for me!
You are the genius!