美文网首页OpenMediaVault
OMV里iframe页面无法打开的解决办法2018-10-19

OMV里iframe页面无法打开的解决办法2018-10-19

作者: 龙天ivan | 来源:发表于2018-10-19 21:20 被阅读55次

OMV里,像shellinabox这种界面里加了iframe的,在omv的设置里默认是打不开的,security禁止了。下面说一下怎么打开。

原因:

主要是OMV在nginx里加了Content Security Policy的设置,限制在iframe窗口中打开

解决:

vi /etc/nginx/openmediavault-webgui.d/security.conf
  1 # Content Security Policy (CSP)
  2 # https://www.owasp.org/index.php/Content_Security_Policy
  3 add_header Content-Security-Policy "default-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' data:;";
  4                                                                                                                                                                                                         
  5 # https://developer.mozilla.org/en-US/docs/Web/HTTP/X-Frame-Options
  6 #add_header X-Frame-Options "SAMEORIGIN";
  7 add_header X-Frame-Options "ALLOW-FROM http://$host";
  8 
  9 # http://blogs.msdn.com/b/ie/archive/2008/07/02/ie8-security-part-v-comprehensive-protection.aspx
 10 add_header X-Content-Type-Options "nosniff";
 11 
 12 # https://wiki.mozilla.org/Security/Features/XSS_Filter
 13 # http://blogs.msdn.com/b/ieinternals/archive/2011/01/31/controlling-the-internet-explorer-xss-filter-with-the-x-xss-protection-http-header.aspx
 14 add_header X-XSS-Protection "1; mode=block";

把第三行:
add_header Content-Security-Policy "default-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' data:;";
前面加#号注释。
改完后:

  1 # Content Security Policy (CSP)
  2 # https://www.owasp.org/index.php/Content_Security_Policy
  3 add_header Content-Security-Policy "default-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' data:;";
  4                                                                                                                                                                                                         
  5 # https://developer.mozilla.org/en-US/docs/Web/HTTP/X-Frame-Options
  6 #add_header X-Frame-Options "SAMEORIGIN";
  7 add_header X-Frame-Options "ALLOW-FROM http://$host";
  8 
  9 # http://blogs.msdn.com/b/ie/archive/2008/07/02/ie8-security-part-v-comprehensive-protection.aspx
 10 add_header X-Content-Type-Options "nosniff";
 11 
 12 # https://wiki.mozilla.org/Security/Features/XSS_Filter
 13 # http://blogs.msdn.com/b/ieinternals/archive/2011/01/31/controlling-the-internet-explorer-xss-filter-with-the-x-xss-protection-http-header.aspx
 14 add_header X-XSS-Protection "1; mode=block";

但是,由于shellinabox的web client是https界面,第一次打开,还是需要先点设置下的『web client』图标,先确认https界面提示,然后才能在iframe中打开。
如果https加了证书的应该就不需要。

相关文章

  • OMV里iframe页面无法打开的解决办法2018-10-19

    OMV里,像shellinabox这种界面里加了iframe的,在omv的设置里默认是打不开的,security禁...

  • 标签的相关应用

    target 在新页面中打开 在自己的页面中打开 在父页面中打开 在顶级页面中打开,例如iframe1...

  • iframe有那些缺点?

    iframe会阻塞主页面的Onload事件;搜索引擎的检索程序无法解读这种页面,不利于SEO;iframe和主页面...

  • iframe有那些缺点?

    iframe会阻塞主页面的Onload事件;搜索引擎的检索程序无法解读这种页面,不利于SEO;iframe和主页面...

  • https嵌套http页面

    背景 https页面里面使用iframe 嵌套了http的页面,浏览器报错,无法正常显示我iframe嵌入的pdf...

  • 前端开发面试

    一、iframe有哪些缺点? iframe会阻塞主页面的Onload事件;搜索引擎的检索程序无法解读这种页面,不利...

  • artDialog v6 iframe 跨域请求

    在iframe中,打开dialog加载子页面。 思路: 父页面打开dialog,在子页面中写提交,获取当前dial...

  • 同源与跨域(二)

    降域 在当前页面下的iframe的域名若与当前页面的域名不同源,则当前页面的js代码对iframe无法进行任何操作...

  • 2018-09-14

    iframe有那些缺点? iframe会阻塞主页面的Onload事件搜索引擎的检索程序无法解读这种页面,不利于SE...

  • HTML 常用标签

    1. iframe 标签 嵌套页面。需要新开一个窗口,速度比较慢。 iframe直接使用 直接打开新页面,内容为百...

网友评论

    本文标题:OMV里iframe页面无法打开的解决办法2018-10-19

    本文链接:https://www.haomeiwen.com/subject/ifwuzftx.html