amazon-web-services - Amazon connect 实例拒绝连接 | 'X-Frame-Options' 至 'sameorigin'

标签 amazon-web-services content-security-policy x-frame-options amazon-connect

<!DOCTYPE html>
        <html>
    
        <head>
          <meta charset="UTF-8">
           <script type="text/javascript" src="connect-streams-min.js"></script>
        </head>
        <!-- Add the call to init() as an onload so it will only run once the page is loaded -->
    
        <body onload="init()">
          <div id="container-div" style="width: 400px; height: 800px;"></div>
          <script type="text/javascript">
            var containerDiv = document.getElementById("container-div");
            var instanceURL = "https://<Amazon connect instance>.my.connect.aws/ccp-v2/";
            // initialize the streams api
            function init() {
              // initialize the ccp
              connect.core.initCCP(containerDiv, {
                ccpUrl: instanceURL,
                loginPopup: true, // optional, defaults to `true`
                loginPopupAutoClose: true, // optional, defaults to `false`
                loginOptions: { // optional, if provided opens login in new window
                  autoClose: true, // optional, defaults to `false`
                  height: 600, // optional, defaults to 578
                  width: 400, // optional, defaults to 433
                  top: 0, // optional, defaults to 0
                  left: 0 // optional, defaults to 0
                },
                loginUrl: "https://<Amazon connect instance>.my.connect.aws/ccp-v2/",
                region: "us-east-1", // REQUIRED for `CHAT`, optional otherwise
                softphone: { // optional, defaults below apply if not provided
                  allowFramedSoftphone: true, // optional, defaults to false
                  disableRingtone: false, // optional, defaults to false
                  ringtoneUrl: "./ringtone.mp3" // optional, defaults to CCP’s default ringtone if a falsy value is set
                },
                pageOptions: { //optional
                  enableAudioDeviceSettings: false, //optional, defaults to 'false'
                  enablePhoneTypeSettings: true //optional, defaults to 'true' 
                },
                shouldAddNamespaceToLogs: false, //optional, defaults to 'false'
                ccpAckTimeout: 5000, //optional, defaults to 3000 (ms)
                ccpSynTimeout: 3000, //optional, defaults to 1000 (ms)
                ccpLoadTimeout: 10000 //optional, defaults to 5000 (ms)
              });
            }
          </script>
          <button onclick="location.href='https://<Amazon connect instance>.my.connect.aws/ccp-v2/'">agent login</button>
        </body>
    
        </html>

  [1]: /image/ZWjzX.png
  [2]: /image/b4IPw.png`
  [3]: /image/4V8uw.png

最佳答案

您尝试构建的网站,甚至是由您构建的页面构建的页面,都会设置响应 header ,将框架限制为同一来源的网站。 “X-Frame-Options:sameorigin”和“Content-Security-Policy:frame-ancestors 'self'”几乎是同一件事,当Content-Security-Policyframe-ancestors时,现代浏览器将忽略X-Frame-Options存在。

此网站不允许任何其他网站对其进行框架设计。如果您控制它,您可以更改该页面上的框架设置。否则,您将不得不以不同的方式执行操作,因为浏览器根本不允许您构建它。

关于amazon-web-services - Amazon connect 实例拒绝连接 | 'X-Frame-Options' 至 'sameorigin',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73931992/

相关文章:

tomcat - tomcat 7 中的 X Frame 选项

amazon-web-services - 带有 --tag-specifications 的 VPC 标签

javascript - Node.js AWS SNS 订阅、确认

amazon-web-services - 创建 AWS Budget Actions 以自动停止 EC2 和 RDS 时出错

java - Amazon Lex AWS Lambda 钩子(Hook)的 Jackson JSON 反序列化

http - CORP 使用 CSP 沙箱集阻止明显同源请求

javascript - 为什么我可以在 JS 中设置样式而不违反内容安全策略 style-src 'self' ?

javascript - 什么 CSP 子 iframe 从其父级继承?

spring-security - 如何使用 spring java 配置将 X-Frame-Options 响应 header 设置为允许来自值?

django - 如何在 Django 中配置 X-Frame-Options 以允许 iframe 嵌入一个 View ?