Select to view content in your preferred language

Is there anyway for WMSLayer to not being required proxy or CORS enabled?

2762
2
Jump to solution
11-04-2015 12:39 AM
WoraminSattayatharn1
New Contributor II

Hi, I'm currently trying to add WMSLayer to my map. I follow this example and it works well.

Here is my code

var layer = new Layer("http://go-tiles1.gistda.or.th/mapproxy/service", { id : "MY_WMS_LAYER" });

map.addLayer(layer);

However, this one requires me to use proxy page. Is there any way that allow me to not use proxy page when creating WMSLayer? I try to add use CORS enabled feature by adding this below code but it is also not working too.

esri.config.defaults.io.alwaysUseProxy = false;
esri.config.defaults.io.corsEnabledServers.push("go-tiles1.gistda.or.th");

0 Kudos
1 Solution

Accepted Solutions
ChrisSmith7
Frequent Contributor

According to the API:

The default behavior of a WMSLayer is to execute a WMS GetCapabilities request, which requires using a proxy page. See the Using the proxy page help topic for more details. An alternate approach is to pass a resourceInfo object into the constructor which does not require a GetCapabilities request.

WMSLayer | API Reference | ArcGIS API for JavaScript

View solution in original post

2 Replies
ChrisSmith7
Frequent Contributor

According to the API:

The default behavior of a WMSLayer is to execute a WMS GetCapabilities request, which requires using a proxy page. See the Using the proxy page help topic for more details. An alternate approach is to pass a resourceInfo object into the constructor which does not require a GetCapabilities request.

WMSLayer | API Reference | ArcGIS API for JavaScript

WoraminSattayatharn1
New Contributor II

Sorry for the late response.

Thanks for the explanation. I will tell my client about this

0 Kudos