mirror of
https://github.com/HeyPuter/puter.git
synced 2026-09-22 21:26:04 +00:00
dav.puter.com CORS headers (#2406)
* webdav cors stuff * if OPTIONS request just let it through
This commit is contained in:
@@ -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 ) {
|
||||
|
||||
Reference in New Issue
Block a user