I've had two Nextcloud servers in my Geeklab for a few years now and since they were installed I've learned a few things that would make it easier for users and Nextcloud have also introduced some new capabilites too. These changes need a reinstall and content migration so I figured it was a good time for an overhaul of my Nextcloud Deployer so I can build dev and test systems as needed with minimum fuss.

Nextcloud supports content Federation to allow users to share documents with other Open Cloud Mesh (OCM) compatible servers. To enable uses to configure shares it generates a personalised Federated Cloud ID for each user which is read only and can be accessed under Settings > Sharing, and as it says in the description has a format very similar to an email address.

Incorrect Federation ID with @http:// in the name

The problem I was getting is the Federated Cloud ID doesn't match the example, as you can see it's including an http:// between the @ and the hostname. I've spent several evenings trying to work out what's going on and despite finding I'm not the only person to encounter this and it's been raised on various forums I've not found any answers. Cross-checking against my current servers showed no variation in config and they didn't have the problem which was even more perplexing, but they've also had a few years of being used, including occaisional changes directly in the database, so they're not perfect comparisions.

A lot of the reported issues looked at the core configuration in [path to Nextcloud]/www/config/config.php and in particular the overwrite.cli.url and overwritehost parameters. Neither of these offered any relief as Nextcloud was generating the correct names and URLs and no proxy is involved at this time. In the end I stripped out all of my customisation and just did a vanilla install, only adding the real hostname into the trusted_domains setting to allow login and triggered another test deployment. It still didn't work, so clearly my config wasn't the issue.

By this point the only other difference between the new Dev systems and my exisiting ones was was running them as straight HTTP. Well, apart from this was a new install onto a fresh Ubuntu 24.04 VM (the existing ones were installed on an earlier version and upgraded in place). My Deployer doesn't handle issuing signed TLS certificates since LetsEncrypt doesn't play nicely with internal hosts and I keep my signing keys offline. But Nextcloud is well behaved and although it grumbles about HTTP it will happily use it. If you're doing TLS termination on a reverse proxy you don't technically need HTTPS internally, although there's some good operational reasons to do so and it's something I insist on for my day job.

Having run out of ideas and before submitting a plea for help to the forum I figured I might as well enable HTTPS on the Dev host just to prove it's not that. With the signed certificate uploaded, a quick update to configure the Apache site template and enable the SSL module (and an Apache restart) and I logged into the dev server using HTTPS, navigated to Settings > Sharing and it's working

A correct Federation ID in email address styling

Just out of curiousity I logged in using an explicit http:// URL and for the same user it showed the Federated ID with the http:// included once more. So Nextcloud is clearly trying to be a bit clever here.

It would be nice to have an explicit config to override the ID generation without messing with other settings for those times when it tries too hard. Proxies make things fun enough for humans who can see the whole network from above, so expecting applications to be able to work things out when they're being deliberately lied to is quite an ask really.

Takeways

  1. When comparing server builds, the use of HTTP or HTTTPS can have some subtle side effects. As I've previously run into with Nextcloud, proxies and Collabora Office so with hindsight this is something I should have tried sooner.
  2. Even the dev systems should have HTTPS enabled for proper testing. I'm thinking that maybe a shortish duration wildcard certificate for the dev domain will be a good compromise as that will be easy to add to the Deployer without having to manually issue a certificate for every test host. Or perhaps an internal signing role with a suitably limited intermediate certificate using something like nameContraint for just the dev domain to help guard against misuse.
  3. I should probably suggest a documentation update to Nextcloud
  4. Stripping out all prior config is worth trying for a major upgrade just to see if there's anything that no longer needs to be explicity set. So there's been some additional payback on this anyway.