Open OmarShehata opened 5 years ago
But instead it makes a request to:
https://proxy.com/?proxyTo=http%3A%2F%2Fserver.com
This is the correct behavior, url parameters must be encoded. Your "expected" version is incorrect. All that's needed here is the doc update (proxy used to be directly on the options object but changed at the beginning of the year when we added Resource)
Could anyone provide the correct example? I tried the following code, but it did not work. Any help will be appreciated.
var viewer = new Cesium.Viewer('cesiumContainer');
var layerUrl = 'https://sampleserver1.arcgisonline.com/ArcGIS/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/WMSServer';
var myResource = new Cesium.Resource( {"url":layerUrl, "proxy":new Cesium.DefaultProxy('/proxy')} );
var provider = new Cesium.WebMapServiceImageryProvider({ "url" : myResource, "layers" : '0' });
viewer.imageryLayers.addImageryProvider(provider);
@giswqs this is the correct version. If you look at the network tab you can see it using the proxy you define.
If you're having trouble getting your imagery work in CesiumJS, please open a new thread on the Cesium forum (https://groups.google.com/forum/#!forum/cesium-dev) and we can discuss it there.
@OmarShehata See below a screenshot of the error message. I am not sure how to resolve the issue. I also replied to a related thread on the Cesium forum. Many thanks!
The doc example on WebMapServiceImageryProvider tells you to pass the proxy as an option:
But
proxy
is not an option on this class! The right way to pass this proxy would be:I'm opening this issue instead of just a PR because I'm running into another problem now. It seems that after I do this, the request doesn't work because the URL is parsed/re-encoded. So the following code:
Is expected to make a request to:
But instead it makes a request to:
I remember seeing an issue that was closed by @hpinkos about this but I can't seem to find it now. This is the forum thread where it most recently came up.