dav.puter.com CORS headers (#2406)

* webdav cors stuff

* if OPTIONS request just let it through
This commit is contained in:
Neal Shah
2026-02-03 14:13:42 -08:00
committed by GitHub
parent cbde123aa1
commit 665aee735b
2 changed files with 6 additions and 1 deletions
@@ -619,7 +619,8 @@ class WebServerService extends BaseService {
// Website(s) to allow to connect
if (
config.experimental_no_subdomain ||
req.subdomains[req.subdomains.length - 1] === 'api'
req.subdomains[req.subdomains.length - 1] === 'api' ||
req.subdomains[req.subdomains.length - 1] === 'dav'
) {
res.setHeader('Access-Control-Allow-Origin', origin ?? '*');
}
@@ -245,6 +245,10 @@ class WebDAVService extends BaseService {
* @param {import("express").Response} res
*/
handler: async ( req, res ) => {
if ( req.method === 'OPTIONS' ) {
this.handleWebDavServer('/', req, res);
return;
}
const svc_su = this.services.get('su');
let actor = await this.handleHttpBasicAuth(req.actor, req, res);
if ( ! actor ) {