2012-10-06 58 views
-1

我试图用ejabberd运行emit(一个gwt实现的xmpp客户端),它工作正常。 我注意到发射的开发人员使用Java servlet来代理请求ejabberd:5920#0:* 52上游超时(110:连接超时),当连接到上游时,

https://github.com/EmiteGWT/hablar/blob/master/src/main/java/de/spieleck/servlets/ProxyServlet.java), 

而且我想绕过这个代理,所以我遵循这个帖子:

http://anders.conbere.org/blog/2011/05/03/get_xmpp_-_bosh_working_with_ejabberd_firefox_and_strophe/ 

但JavaScript客户端(从EMIT遵守)花费很长时间才能连接到ejabbered,然后迅速断开,而Nginx的错误日志是这样的:

2012/10/06 17:04:33 [error] 5920#0: *52 upstream timed out (110: Connection timed out) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "POST /http-bind HTTP/1.1", 
upstream: "http://111.186.4.11:5280/http-bind", host: "127.0.0.1", referrer: "http://127.0.0.1/hablartest/HablarTest1.html" 

谁能告诉我是什么I D编号错误?

我的配置: 中的firefox-13 ejabberd-2.1.11的nginx-1.0.5 Ubuntu的11.10

(因为来自GWT遵守同样的客户端代码(js代码)与servlent代理工作正常,所以我认为它可能是一个nginx的配置问题)

回答

0

最后,我发现了问题:我的代理配置是这样的:

location ~ ^/http-bind {  
     proxy_pass http://localhost:5280; 
} 

所以nginx的都将请求重定向从127.0.0.1:80为localhost:5280

这将正常工作,如果我从互联网断开,但如果我连接到互联网,我的hosts文件就变成了:

127.0.0.1  luya localhost.localdomain localhost 
111.186.4.11 luya localhost.localdomain localhost 

从我的理解,本地主机将“采取”可能为127.0.0.1或111.186。 4.11随机,因此它是本混乱引起problem.Solution简单,改变代理配置

proxy_pass http://localhost:5280; 

proxy_pass http://127.0.0.1:5280;