I am getting same error again and again. I have used helmet for X-Frame-Options and for other headers use access-allow. In firefox Console shows "Load denied by X-Frame-Options: does not permit framing." In chrome console shows "Refused to display in a frame because it set 'X-Frame-Options' to 'sameorigin'." Please give me some solution. Any suggestion will be appreciated. Here is the code:
var app = express();
var helmet = require('helmet');
app.use(helmet({
frameguard: {
action: 'allow-from',
domain: 'https://calendar.google.com/calendar/'
}
}))
var enableCORS = function(req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');
res.header('Access-Control-Allow-Headers', 'Content-Type, token, Content-Length, X-Requested-With, *');
if ('OPTIONS' === req.method) {
res.sendStatus(200);
} else {
next();
}
};
app.all("/*", function(req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');
res.header('Access-Control-Allow-Headers', 'Content-Type, token, Content-Length, X-Requested-With, *');
// res.set('X-Frame-Options', 'ALLOW-FROM htps://google.com/');
next();
});
app.use(enableCORS);