我正在使用http-bind
openfire启用BOSH
和访问该服务strophe
,问题是我在chrome中遇到以下错误
这是控制台中的错误
XMLHttpRequest无法加载
http://127.0.0.1/http-bind
。请求的资源上不存在“ Access-Control-Allow-Origin”标头。'http://localhost'
因此,不允许访问原点。
这是要求
我BOSH
在openfire中启用了以下功能
我曾尝试在apache
配置文件中执行以下操作,httpd.conf
但没有效果
<Proxy /http-bind>
Order allow,deny
Allow from all
</Proxy>
ProxyPass /http-bind http://127.0.0.1:7070/http-bind
ProxyPassReverse /http-bind http://127.0.0.1:7070/http-bind
The error No 'Access-Control-Allow-Origin' header is present on the requested resource
indicates that you are making a Cross-domain (CORS) request and the necessary CORS headers are not available.
You are making a cross-domain request because the BOSH service (i.e. http-bind
) is being served on a different port than your website.
I see in your HTTP Bind settings for OpenFire that you have enabled CORS. Perhaps you are using a Browser that doesn't support CORS? (Like IE9).
In any case, you can solve this for all browsers by instead of using CORS, reverse proxying the http-bind
address to be on the same domain and port as from which the HTML is served.
This snippet in Apache will do that for you: (I'm assuming you're serving the site on port 80).
<VirtualHost *:80>
ServerName localhost
RewriteEngine On
RewriteRule ^/http-bind(.*) http://localhost:7070/http-bind$1 [P,L]
</VirtualHost>
这样,您便可以在http-bind
与站点本身相同的域(和端口)上访问BOSH服务(即)。
有关更多信息,请参见Converse.js文档。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句