Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I've upgraded to GeoServer 2.3.0 running on Apache Tomcat 7.0.39 on my host WebFaction. My websites and GeoServer are on same host but different ports. How do I go about setting a proxy so that my site domain can grab data from GeoServer. I remember using a proxy.cgi with openlayers, but I'm now using Leaflet.

Is it possible to have my sites with domain capecodgis.com retrieve data from tomcat.capecodgis.com/geoserver.

I apologize in advance if I'm not clear. This is very confusing. I've been reading different docs and forums to no avail

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

When you want to make a XHR request to tomcat.capecodgis.com/geoserver from capecodgis.com, it will not be directly possible because this is a crossdomain request.

Generally speaking in the case of crossdomain, resources such as images, JavaScript files etc can be requested across domains. But for JavaScript to make a request to a service is not allowed.

This raises the question: What are you trying to do? If you are just trying to show a map using WMS, then it will work fine, since the JavaScript is just requesting Images. If you are requesting data from a service, (say from a WFS service, or a GetFeatureInfo request) then that will require a proxy.

Further more, looking at the LeafLet API Docs, it does not appear to support any functionality, which would require a proxy.

What I would do, is to create the website, and then test it using FireBug. If there was some request, which could not be sent due to crossdomain issues, you will see that as an error in FireBug's Console. I would then work only only that request.

share|improve this answer
    
thank you for the answer, at least now I know where to start. –  geomajor56 Apr 8 '13 at 13:33
    
I'm making a WFS request to return geojson data. I get an error in Firebug: SyntaxError: invalid label, which points to a valid geojson object. I cut and paste it into geojson lint and it's fine. So apparently the request works fine. In the Firebug console it says there was an error in transfer and it won't pass the data to the Leaflet function. –  geomajor56 Apr 8 '13 at 13:50
    
using the $.ajax error: function, I tried to pass it along to the Leaflet function anyways and it returned the error Invalid GeoJson object. Yet it is valid. –  geomajor56 Apr 8 '13 at 13:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.