Authentication to RC via NC fails

Description

So I have set up a RC instance and a Nextcloud instance. (BTW: I have tried the new integration app but haven’t got it to work yet.)
I am now trying to enable RC users to authenticate by logging in to NC. Eventually this fails with an RC notification in my browser saying “undefined”.

Server Setup Information

  • Version of Rocket.Chat Server: 4.6.3
  • Operating System: Debian 11
  • Deployment Method: docker(-compose)
  • Number of Running Instances: 1
  • DB Replicaset Oplog: yes
  • NodeJS Version: 14.18.3
  • MongoDB Version: 5.0.7
  • Proxy: HAProxy
  • Firewalls involved: pfSense

Any additional Information

When the authentication fails, I find this in the RC logs:

{"level":50,"time":"2022-05-11T20:35:24.874Z","pid":2997,"hostname":"xxxxxxxxxxxx","name":"System","msg":"Exception while invoking method login 'Failed to complete OAuth handshake with nextcloud at https://nc.example.com/index.php/apps/oauth2/api/v1/token. network timeout at: https://nc.example.com/index.php/apps/oauth2/api/v1/token'"}

And I can see an issue here: My NC URLs don’t contain “/index.php”. The URL should be “https://nc.example.com/apps/oauth2/api/v1/token” but I can’t find a way to tell RC how to construct the URL…