feat(caldav): implement service discovery for CalDAV with redirection
All checks were successful
Build & Push Docker Image / build (push) Successful in 6m25s

This commit is contained in:
2026-03-04 22:33:43 +01:00
parent d8c52aae4e
commit 11d3972a74

View File

@@ -79,6 +79,21 @@ async function start() {
app.use('/api/federation', calendarRoutes); app.use('/api/federation', calendarRoutes);
app.get('/.well-known/redlight', wellKnownHandler); app.get('/.well-known/redlight', wellKnownHandler);
// ── CalDAV service discovery (RFC 6764) ──────────────────────────────────
// Clients probe /.well-known/caldav then PROPFIND / before they know the
// real CalDAV mount point. Redirect them to /caldav/ for all HTTP methods.
app.all('/.well-known/caldav', (req, res) => {
res.redirect(301, '/caldav/');
});
// Some clients (e.g. Thunderbird) send PROPFIND / directly at the server root.
// Express doesn't register non-standard methods, so intercept via middleware.
app.use('/', (req, res, next) => {
if (req.method === 'PROPFIND' && req.path === '/') {
return res.redirect(301, '/caldav/');
}
next();
});
// Serve static files in production // Serve static files in production
if (process.env.NODE_ENV === 'production') { if (process.env.NODE_ENV === 'production') {
app.use(express.static(path.join(__dirname, '..', 'dist'))); app.use(express.static(path.join(__dirname, '..', 'dist')));