I would like to display an iframe with a Github source as follows:
<iframe src="https://gist.github.com/user45445/9bf8d568e3350146ba302d7d67ad576f"> </iframe>
This is the error I get in the console:
Refused to display 'https://gist.github.com/fresh5447/9bf8d568e3350146ba302d7d67ad576f' in a frame because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'none'".
I studied how to specify mine Content Security Policyon my server Nodeto indicate that it should accept any iframes fromgithub
So, I installed csp-helmet and added this to my server code:
var csp = require('helmet-csp')
app.use(csp({
directives: {
frameAncestors: ['*.github.com'],
childSrc: ['*.github.com']
},
reportOnly: false,
setAllHeaders: false,
disableAndroid: false,
browserSniff: true
}))
But still the same mistake.
I'm trying to see white papers and HTML5 rocks
Not sure if I'm too close or completely wrong.
Update
I also tried installing CSP using a tag meta.
<meta http-equiv="Content-Security-Policy" content="child-src https://gist.github.com; frame-ancestors https://gist.github.com;">
than i got this error:
Content Security Policies delivered via a <meta> element may not contain the frame-ancestors directive.
Thanks in advance.