I am trying to request WMS layers to display onto my globe which have been getting blocked due to CORS. I am trying to set up the cesium default proxy but am struggling to find much documentation on how this is achieved. Could somebody guide me through how to set this proxy up so that I don't have to enable CORS please?
If you’re using the Cesium development web-server (i.e. running ant runServer
), you can either modify build.xml and modify runServer.allowedHosts
to include your site (or simply change the value to *
.
You can also pass runServer.allowedHosts
on the command line for example
ant runServer -DrunServer.allowedHosts="*"
So are you saying that I have to be running on the dev web-server to use the DefaultProxy? Or is it possible to use running on other servers?
If you are using your own proxy, you need to pass the url of the proxy to the DefaultProxy constructor. This assumes your proxy works by taking a single query parameter which is the url of the resource to retrieve. Otherwise you need to implement your own proxy object, which is simply an object with a function named getURL
that takes the url of the resource to retrieve. Keep in mind that DefaultProxy is an incredibly simple object that just calls through to a proxy server.
If this doesn’t answer all of your questions, tell us a little bit more about your set up and we’ll try and point you in the right direction.
I have managed to get it working running on the ant server. Thank you for your help. I think that this should be made clearer in the tutorials to benefit others because I struggled to find any information on how to achieve this.