Skip to content

Commit

Permalink
[FIX] Replace obsolete X-FRAME-OPTIONS header on Livechat route (#17419)
Browse files Browse the repository at this point in the history
Replace deprecated X-FRAME-OPTIONS header by Content-Security-Policy.

Co-authored-by: Marcos Spessatto Defendi <marcos.defendi@ulbra.inf.br>
  • Loading branch information
renatobecker and MarcosSpessatto authored May 1, 2020
1 parent 2808ce7 commit ef77a21
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/livechat/server/livechat.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ WebApp.connectHandlers.use('/livechat', Meteor.bindEnvironment((req, res, next)

const referer = url.parse(req.headers.referer);
if (!_.contains(domainWhiteList, referer.host)) {
res.setHeader('X-FRAME-OPTIONS', 'DENY');
res.setHeader('Content-Security-Policy', 'frame-ancestors \'none\'');
return next();
}

res.setHeader('X-FRAME-OPTIONS', `ALLOW-FROM ${ referer.protocol }//${ referer.host }`);
res.setHeader('Content-Security-Policy', `frame-ancestors ${ referer.protocol }//${ referer.host }`);
}

res.write(indexHtmlWithServerURL);
Expand Down

0 comments on commit ef77a21

Please sign in to comment.