我在反向代理背后的Java Restlet服务器存在一个非常奇怪的问题。请求在反向代理后面的restlet服务器永远不会完成
我使用nginx的一个URL重定向到该服务器配置这样在端口8182一个的Restlet服务器:
server {
listen 8080;
server_name localhost;
location/{
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
allow all;
root C:/Users/Cyrille/www;
index index.html index.htm;
}
location /proxy/ping {
proxy_pass http://localhost:8182/ping;
}
}
当我打开浏览器或使用wget访问http://localhost:8080/proxy/ping
,请求代理到Restlet。它回答了与简单的“乒乓”,它的日志显示:
Oct 29, 2013 11:45:04 AM org.restlet.engine.log.LogFilter afterHandle
INFO: 2013-10-29 11:45:04 127.0.0.1 - - 8182 GET /ping - 200 4 - 6 http://localhost:8182 Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36 -
的问题是,浏览器似乎没有以往任何时候都接收响应。几分钟后,它会超时,出现错误504:Gateway Time-out(网关超时)。如果我直接访问http://localhost:8182/ping
,请求立即完成。
什么时候可以阻止请求?我禁用了任何防火墙或防病毒软件。我已经与Apache交换了nginx,并且我获得了完全相同的行为。我在Windows 8上。