feat(caldav): implement service discovery for CalDAV with redirection
All checks were successful
Build & Push Docker Image / build (push) Successful in 6m25s
All checks were successful
Build & Push Docker Image / build (push) Successful in 6m25s
This commit is contained in:
@@ -79,6 +79,21 @@ async function start() {
|
||||
app.use('/api/federation', calendarRoutes);
|
||||
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
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
app.use(express.static(path.join(__dirname, '..', 'dist')));
|
||||
|
||||
Reference in New Issue
Block a user