Webdav not working properly on fastCGI

Unfortunately I cannot use PHP-FPM on fastCGI (on cPanel) and because of this, mod_php does not completely work. For the most part, everything is working correctly except the webDav login.
When logging in using the Desktop client or Android app, it successfully authorizes the app but it immediately tries to redirect to the wrong domain and it returns a Connection closed or 401
The domain being “https://cloud.domain.com/remote.php/webdav/” instead of my own domain.

Logging in just using the browser works, files are uploaded and downloaded with no problem, but the clients always try to redirect to the wrong domain. Is there a way to fix this?