Accessing files with a js/webapp hosted on another domain, by webdav or any other mean, is it possible?

I’m trying for some days now to access files from a js fetch/ajax request hosted on another domain.

Nextcould is installed on a subdomain of my hosting, another site is installed on another subdomain and I try to access files on the NextCloud from a javascript on the other site.

I always end with the same CORS error.

I tried with webdav and also with share/download.
I tried to use the webapppassword app too (to specify a trusted domain) but to no avail.

The preflight request with OPTIONS works but everything else (POST, GET) is blocked by CORS.

So I’m now asking myself, is it even possible in the current state of NextCloud.

Has someone achieved it? Could someone give me pointers?

Many thanks for your time!


I think this is a known problem: Support for cross-domain WebDAV access (CORS) · Issue #3131 · nextcloud/server · GitHub

There might be a way through OCS (which is less strict w.r.t. CORS) but I am unsure and I did not and anything in a quick glance at the code. No guarantee though.