OpenLayers 2 – When Is a Proxy Needed with OpenLayers 2?

geoserveropenlayers-2PROXY

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?

Best 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.

Related Question