当我从本地计算机调用 Amazon connect 实例时 我正面临着这个 错误-Amazon connect instance refused to connect 在控制台中 显示此问题:ancestor violates 。在“< URL >”中是:
https://< Amazon connect Instance name >.my.connect.aws/.
当我在云环境中运行它时,它显示 enter image description here
这是我在index.html中运行的代码:
<!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/