Access Mailbox From A Subdomain

This seems to sort-of working. However, if I have multiple domains, this solution attempts to redirect everything to the one domain I put in here.

How to I address this issue? Specifically, I want to use the nextcloud client to connect to the shared cloud storage for different domains. So if I have abc.com and xyz.com, I need to use https://abc.com/cloud to access files for that domain and https://xyz.com for files on the latter domain.

The mail works fine for multiple domains, as does the admin page, but cloud does not.

I think I have found what I was looking for!