66e0b84e12
Currently, homepages are still build as part of the app, so this change doesn't bring much benefit other than to support the wrapper app. When the service is moved away from the app, we won't have to rebuild the app when homepages change, and also the ui.js bundle would be smaller without the need to code-split.
16 lines
414 B
JavaScript
16 lines
414 B
JavaScript
const PAGES = require('../../ui/constants/pages');
|
|
|
|
async function iframeDestroyerMiddleware(ctx, next) {
|
|
const {
|
|
request: { path },
|
|
} = ctx;
|
|
const decodedPath = decodeURIComponent(path);
|
|
|
|
if (!decodedPath.startsWith(`/$/${PAGES.EMBED}`) || !decodedPath.startsWith(`/$/api/content/v1/get`)) {
|
|
ctx.set('X-Frame-Options', 'DENY');
|
|
}
|
|
|
|
return next();
|
|
}
|
|
|
|
module.exports = iframeDestroyerMiddleware;
|