Service discovery urls for Nextcloud with an Nginx reverse proxy

After installing Nextcloud a couple of days ago, I was left with a warning in the management ui about misconfigured service discovery urls:

Dein Webserver ist nicht ordnungsgemäß für die Auflösung von .well-known-URLs eingerichtet. Fehler bei: /.well-known/webfinger Weitere Informationen findest du in der Dokumentation

Some URLs starting with .well-known have not been correctly configured. The Nextcloud docker image that I’m using comes with it’s own Nginx webserver baked in the container, but I suspected that it’s probably my reverse proxy that didn’t handle the requests correctly.

Looking at the configuration of the baked in Nginx, some of the configurations were indeed present, but they caused the client to redirect to an internal ip address. Also, two of the four required configurations were missing (/.well-known/webfinger and /.well-known/nodeinfo).

I removed those configurations from the internal Nginx configuration and configured my reverse proxy to handle those URLs:

server {
# ...
location = /.well-known/carddav { return 301 /remote.php/dav/; }
location = /.well-known/caldav { return 301 /remote.php/dav/; }
location = /.well-known/webfinger { return 301 /index.php/.well-known/webfinger; }
location = /.well-known/nodeinfo { return 301 /index.php/.well-known/nodeinfo; }
# ...
}
view raw nginx.conf hosted with ❤ by GitHub

With this configuration in place, the warnings in the management ui were gone.

Leave a Reply

Your email address will not be published. Required fields are marked *