Proxy question

Hello again! I’ll try to make this quick:

Only proxy I can find in B14 is in dojox/io/proxy… (Not sure this is what you recommend using).

I found Tools/proxy in your github and uploaded it to /proxy/ & /tools/proxy/ on my webserver with 0 results.

Got my hosting admin to enable CORS as per the enable-cors.org website.

Cross-image errors across the board so I may as well use a proxy.

Do I need to use the build.xml in the root folder or the one in the proxy folder to add new domains?

Thank you!

  • Adam

Hi Adam,

Our proxy is in Tools/proxy, but it’s designed to work with the Jetty web server that comes with Cesium, so just uploading it to your web server is unlikely to work.

It’s probably worthwhile to figure out why your cross-origin headers aren’t working rather than using a proxy. What error are you getting exactly?

If you want to use the Cesium web server and proxy, you’ll need to modify the build.xml in the root folder, and then start the web server by running “ant runServer”.

Kevin

Okay, thank you Kevin.

I figured it would take more than just copying the files in.

The header is where I’m getting confused.

I wasn’t sure if CORS needs to be enabled on every website I’m retrieving the overlays from or if I just need to include something like XMLhttprequest somewhere in my index.html…

Any chance you could show me where in the code I would put this header?

I’m confused as to where it should be placed…

Potentially in this somewhere?:

addAdditionalLayerOption(

‘Single image’,

new Cesium.SingleTileImageryProvider({

url : ‘http://crossimagerywebsite-example.com/Cesium_Logo_overlay.png’,

extent : new Cesium.Extent(

Cesium.Math.toRadians(-115.0),

Cesium.Math.toRadians(38.0),

Cesium.Math.toRadians(-107),

Cesium.Math.toRadians(39.75))

}),

1.0);

}

Or would it be somewhere in the beginning of the code.

And while we’re on the topic, I understand adjusting the alpha value at the end of the js but besides making it 0.0, is there a way to not even have the checkmark checked in the table and the layer disabled on particular overlays?

Thank you for your help!

Cheers,

  • Adam

Okay I realize now that CORS needs to be abled on every server I access.

Therefore, with help, I was able to just create a simple .php proxy per image I need to overlay and it worked great!

If anyone else is having this issue (probably newbies like me),

Create a .php file in your root folder called overlay1.php and put only this code inside:

<?php header ("Content-Type: image/gif"); echo file_get_contents('http://www.whateverwebsite.com/whatever.gif'); (I trust you can use image/png instead of gif depending on the image type) Then use: url: ('/overlay1.php?') in your overlay code and it works! If only I knew it was that easy before 2 days of working with CORS. lol, - Adam