Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/kubernetes/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Security xmpp Opera抛出安全错误_Security_Xmpp_Opera - Fatal编程技术网

Security xmpp Opera抛出安全错误

Security xmpp Opera抛出安全错误,security,xmpp,opera,Security,Xmpp,Opera,编程大师! 我根据《XMPP编程》一书创建了一些聊天室,因此我在项目中加入了strophe.js和gab.js。一切都很好,服务在IE和Firefox中都正常工作。但不是Opera,Opera在本例中抛出了一个异常 Uncaught exception: ReferenceError: Security violation Error thrown at line 2554, column 16 in <anonymous function: _processRequest>() i

编程大师! 我根据《XMPP编程》一书创建了一些聊天室,因此我在项目中加入了strophe.js和gab.js。一切都很好,服务在IE和Firefox中都正常工作。但不是Opera,Opera在本例中抛出了一个异常

Uncaught exception: ReferenceError: Security violation
Error thrown at line 2554, column 16 in <anonymous function: _processRequest>() in http://chat.aviportal.com/strophejs/strophe.js:
req.xhr.send(req.data);
called from line 2566, column 16 in <anonymous function: _processRequest>(i) in http://chat.aviportal.com/strophejs/strophe.js:
sendFunc();
called from line 2607, column 12 in <anonymous function: _throttledRequestHandler>() in http://chat.aviportal.com/strophejs/strophe.js:
this._processRequest(0);
called from line 2709, column 16 in <anonymous function: _onRequestStateChange>(func, req) in http://chat.aviportal.com/strophejs/strophe.js:
this._throttledRequestHandler();
这就是我初始化strophe连接的方式,该过程将在conn.connect上启动guest2@chat.aviportal.com"等) 在该行上抛出异常。
顺便说一句,什么是CORS,跨域请求?ejabberd与php文件位于同一子域上,因此我不认为,但是,如果您使用的库是基于jQuery的,则很可能是^ ^ ^

尝试将其放在您的文件中:

jQuery.support.cors=true

此错误是由Opera阻止跨站点请求引起的。如果服务器端脚本允许,CORS将允许从普通网页发出跨站点请求。阅读更多


目前,Opera只允许在扩展名内进行跨站点请求,只要您在config.xml文件中。即便如此,如果您试图在扩展名中使用jQuery来发出XSS请求,您将遇到安全冲突,除非您在文件中包含我在开头提到的行。

尽管您的Web服务器与ejabberd运行在同一个域上,访问不同的端口确实构成跨域请求,并应引发安全异常。因此,连接到
域:5280
域:80
不同

要轻松解决此问题,您应该在设置中包含一个代理。很可能前面已经有apache或nginx,所以您应该只使用代理
域:80/http绑定
转到
域:5280
。例如,对于nginx,您应该有如下内容:

    location /http-bind {
        proxy_buffering off;
        tcp_nodelay on;
        keepalive_timeout 55;
        proxy_pass http://localhost:5280;
    }

在nginx.conf.

中,您也可以在不使用Jquery的情况下修复此问题

在从中提取数据的文件头中添加以下内容:

Access-Control-Allow-Origin: *

您如何加载此库以及对其执行什么请求?在Opera 12以下的版本中缺少CORS支持?非常感谢。我会尝试这样做,如果成功,我会写。我认为Strophe.js不使用jQuery。非常感谢Ggozad,你知道我从来没有考虑过同一个域上的不同端口被认为是跨域的。插入Nginx,一切正常)]@Cfyzz很高兴它能工作,请接受答案,这样它就关闭了。
Access-Control-Allow-Origin: *