[GIS] Help Setting up GeoServer Proxy with OpenLayers

geoserveropenlayers-2PROXY

I have a GeoServer WMS in Apache-Tomcat at http://localhost:8080 and a mod_wsgi app in standard Apache at http://localhost:80/myapp.

My OpenLayers map is being hosted statically by the Apache-Tomcat Geoserver app at http://localhost:8080/geoserver/www/OL.html. The JavaScript in this map has to call the mod_wsgi app for non geographic data.

I've tried setting up a proxy in GeoServer the following ways

http://localhost:80/mypp

http://localhost

localhost

None of these work. After making a request some of my response object attributes look like this which means it's not really working. GeoServer logs show no errors

priority "NORMAL"
readyState 4
responseText ""
responseXM Lnull
status 0
statusText ""

Can't say I'm too much of an expert at Proxies. But it seems to me that I wouldn't need to set up a OpenLayers proxy (as mentioned here) if GeoServer can proxy for me.

Ideas, hints, advice?

Best Answer

well, it seems that the obvious was at play here. The 'text/plain' mimetype was the cause of the issue. Once i added this to GeoServer's proxy mimetypes and changed my proxy to be "localhost:80" then everything worked.

For future people seeing this post i tested it using JQuery. The GET request looks like this:

$.get("/geoserver/rest/proxy?url=localhost:80/myapp";, {format : 'text/plain'}, function(data){console.log(data); })