Friday, 29 May 2015

openlayers 2 - When do I need to use a proxy with OpenLayers2?


When exactly do I need to use a proxy with openlayers? I've done a lot of reading on this but can't seem to find a definitive answer. Wondering if this is the route of my problems.



For instance, if I have one server running Geoserver (WFS) on port 8080 and Apache (serving OpenLayers) on port 80 would I need to use a proxy?


If the servers are physically separate would I need to use proxy?



Answer



You need a proxy if you are making an AJAX request to a machine and/or port that is different from the one that your webpage was served from.


So in both your examples above you will need a proxy (on the server that is serving the webpage) if you want to make WMS getfeatureinfo requests or any sort of WFS request. However you do not need a proxy for simple WMS getMap requests.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...