我开发了一个使用 GeoServer 的 OpenLayers Web 应用程序。我使用 nginx 作为我的网络服务器,并为 GeoServer 设置了 proxy_pass。当我使用“localhost”时,一切都按预期工作,但是当我切换到我的 IP 地址时,我收到 504 Gateway Time-Out 错误
http://98.153.141.207/geoserver/cite/wfs.
我可以在以下位置访问 GeoServer
http://98.153.141.207/geoserver/web
通过浏览器没有问题,因此看起来代理继续按预期工作。
发生问题时,GeoServer 日志会显示:
Request: describeFeatureType
service = WFS
version = 1.1.0
baseUrl = http://98.153.141.207:80/geoserver/
typeName[0] = {http://www.opengeospatial.net/cite}MyLayer
outputFormat = text/xml; subtype=gml/3.1.1
然后一分钟后,我在我的 JavaScript 控制台中得到 504 Gateway Time-Out,这显示在 GeoServer 日志中:
09 May 06:02:15 WARN [geotools.xml] - Error parsing: http://98.153.141.207/geoserver/wfs/DescribeFeatureType?version=1.1.0&typename=cite:MyLayer
我已经在浏览器中尝试了这个假定的问题 URL,它工作正常。
nginx 错误日志包含以下内容:
2013/05/09 06:02:15 [error] 420#3844: *54 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while reading response header from upstream, client: 98.153.141.207, server: localhost, request: "GET /geoserver/wfs/DescribeFeatureType?version=1.1.0&typename=cite:MyLayer HTTP/1.1", upstream: "http://127.0.0.1:8080/geoserver/wfs/DescribeFeatureType?version=1.1.0&typename=cite:MyLayer", host: "98.153.141.207"
进一步的调查表明,这个问题似乎仅限于 WFS 层。WMS 图层工作正常。这是我的 WFS 层失败的声明:
myLayer = new OpenLayers.Layer.Vector("MyLayer",
{
strategies: [new OpenLayers.Strategy.BBOX(),saveStrategy],
projection: "EPSG:2276",
protocol: new OpenLayers.Protocol.WFS(
{
version: "1.1.0",
url: "http://" + hostip + "/geoserver/cite/wfs",
featureNS: "http://www.opengeospatial.net/cite",
srsName: "EPSG:2276",
featureType: "MyLayer",
geometryName: "Poly",
schema: "http://" + hostip + "/geoserver/wfs/DescribeFeatureType?version=1.1.0&typename=cite:MyLayer"
})
});
任何帮助,将不胜感激。谢谢
我设法通过从我的层的 OpenLayer.Protocol.WFS 中删除“模式”属性来完成这项工作。谁能解释为什么这会是问题?