Fix: Allow iframe embedding from frontend origin using CSP frame-ancestors
This commit is contained in:
@@ -241,6 +241,9 @@ function createKnowledgeBaseRouter(db, upload) {
|
|||||||
res.setHeader('Content-Type', contentType);
|
res.setHeader('Content-Type', contentType);
|
||||||
// Use inline instead of attachment to allow browser to display
|
// Use inline instead of attachment to allow browser to display
|
||||||
res.setHeader('Content-Disposition', `inline; filename="${row.file_name}"`);
|
res.setHeader('Content-Disposition', `inline; filename="${row.file_name}"`);
|
||||||
|
// Allow iframe embedding from frontend origin
|
||||||
|
res.removeHeader('X-Frame-Options');
|
||||||
|
res.setHeader('Content-Security-Policy', "frame-ancestors 'self' http://71.85.90.9:3000 http://localhost:3000");
|
||||||
res.sendFile(row.file_path);
|
res.sendFile(row.file_path);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user