WebMapServiceTerrainProvider and Proxy setting

Dear Developer team
I'm testing cesium for my company to identify the best webgl globe currently available.
Cesium works great, and promises good thinks for the future...but I have a question related to the WebMapServiceTerrainProvider.

I have seen and tested the Imagery Adjustment Sandcastle demo (on cesiumjs.org) demo in which some WMS layers are loaded by the WebMapServiceTerrainProvider and everything works great.
I tried the same example in local and nothing works.

The error is "http://IP/proxy/?http%3A%2F%2Fmesonet.agron.iastate.edu%2Fcgi-…rs%3DEPSG%3A4326%26bbox%3D-90%2C0%2C0%2C90%26width%3D256%26height%3D256%26 404 (Not Found) " (obviously)

the code is exactly the Sandcastle one

new Cesium.WebMapServiceImageryProvider({
                    url : ‘http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi?’,
                    layers : ‘nexrad-n0r’,
                    credit : ‘Radar data courtesy Iowa Environmental Mesonet’,
                    parameters : {
                        transparent : ‘true’,
                        format : ‘image/png’
                    proxy : new Cesium.DefaultProxy(’/proxy/’)

I understood that the "proxy" option is used to avoid the "Cross-origin image load denied by Cross-Origin Resource Sharing policy." but I haven't understood how set it.

Could someone explain to me how set the WebMapServiceTerrainProvider options in order to allow me to run the exactly demo in local?


By local, do you mean you’re not using the web server that comes with Cesium? If so, there’s no configuration you can do in Cesium that will solve your problem. You need to implement a proxy on your web server.

The proxy that Cesium needs is simple. It takes a URL as a query parameter, requests that URL itself, and then returns the result of that request to the original client. All of this is necessary because the WMS server in your example does not honor CORS requests (or at least it didn’t last time I checked), and WebGL is not allowed to use images downloaded from remote servers without proper CORS headers.

If you have control over the WMS server, a much much better solution is to modify the server to include CORS headers, and then remove the proxy property entirely when creating the WMSImageryProvider. If your WMS server is GeoServer you just need to install CORS Filter: