admin管理员组文章数量:1426491
I have 2 projects in node JS. I have included the response to the header of my project is res. header('X-Frame-Options','SAMEORIGIN').
When I generate the source link and include it with the element , this link only working for my domain, I can't include the with other domains.
How can access the with a different domain
Thank you...!
I have 2 projects in node JS. I have included the response to the header of my project is res. header('X-Frame-Options','SAMEORIGIN').
When I generate the source link and include it with the element , this link only working for my domain, I can't include the with other domains.
How can access the with a different domain
Thank you...!
Share Improve this question asked Feb 5, 2021 at 5:46 Thamarai KaniThamarai Kani 111 silver badge6 bronze badges2 Answers
Reset to default 4when it es to security, I suggest using helmet.js. So better install helmet.js then use it as middleware for security issues. For example write code below:
const express = require("express");
const helmet = require("helmet");
app = express();
app.use(helmet({
contentSecurityPolicy: {
directives: {
"frame-ancestors": ["'self'", "https://otherDomain.", "https://www.oneMoreDomain."]
}
}
}));
ContentSecurityPolicy's frame-ancestors is doing the same thing as FRAME-OPTIONS, but you can add whitelist of domains which will have permission using frames.
The main purpose of adding the X-Frame-Options
headers is to prevent your page from being rendered within an <iframe>
(or within a <frame>
, <embed>
, <object>
). Based on the value of the header, you can prevent it pletely or just allow embedding within the same origin.
So if you need to allow rendering your page from any domain, you can just remove that header from the response.
Please refer this for more details https://developer.mozilla/en-US/docs/Web/HTTP/Headers/X-Frame-Options
本文标签: javascript39XFrameOptions3939SAMEORIGIN39 Cross Domain Iframe issueStack Overflow
版权声明:本文标题:javascript - 'X-Frame-Options','SAMEORIGIN' Cross Domain Iframe issue - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745373763a2655845.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论