Loading cesium over https

316 views
Skip to first unread message

Scott Haynes

unread,
Jan 22, 2014, 10:03:27 AM1/22/14
to cesiu...@googlegroups.com
I'm trying to load our VWF Cesium application over https( over the company network, we're using websockets, so we had to move to https).  Is there a version of the content that can be served out via https?

Link:

Kevin Ring

unread,
Jan 22, 2014, 10:26:22 AM1/22/14
to cesiu...@googlegroups.com
Hi Scott,

There's no out-of-the-box way to do it unfortunately, but it's easy to do by changing the BingMapsImageryProvider.  You just need to replace 'http' with 'https'.  Here's a hacky but working approach:

Change BingMapsImageryProvider.js, around line 128 to look like this (new line in bold):

var metadataUrl = this._url + '/REST/v1/Imagery/Metadata/' + this._mapStyle.imagerySetName + '?key=' + this._key;
metadataUrl = metadataUrl.replace('http:', 'https:');
var that = this;

And around line 412:

var url = buildImageUrl(this, x, y, level);
url = url.replace('http:', 'https:');
return ImageryProvider.loadImage(this, url);

I had hoped that just passing in a new URL with 'https' to the BingMapsImageryProvider would do the trick.  But unfortunately the result of the Bing Maps metadata service still includes http URLs even if accessed via https.

Kevin



--
You received this message because you are subscribed to the Google Groups "cesium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cesium-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--

Scott Hunter

unread,
Jan 22, 2014, 10:28:49 AM1/22/14
to cesiu...@googlegroups.com
It looks like Bing Maps supports HTTPS for their imagery metadata service.  Try constructing your BingMapsImageryProvider and passing in:


instead of the default HTTP URL.


On Wed, Jan 22, 2014 at 10:03 AM, Scott Haynes <scottn...@gmail.com> wrote:

Kevin Ring

unread,
Jan 22, 2014, 10:31:40 AM1/22/14
to cesiu...@googlegroups.com
Yep, that was the first thing I tried.  Sadly the imageryUrl returned in the metadata response is still http.

Scott Haynes

unread,
Jan 22, 2014, 10:46:28 AM1/22/14
to cesiu...@googlegroups.com
What if the code in the first reply added a check for the current protocol prior to swapping from http to https?

This has actually been an issue for months, so we don't necessarily need an immediate fix.  I could even fix it and issue a pull request if that's better.

Scott

Kevin Ring

unread,
Jan 22, 2014, 10:51:01 AM1/22/14
to cesiu...@googlegroups.com
A robust solution would check for https in the metadata URL (but not add it), and if the metadata URL is https, it would change http to https in the _imageUrlTemplate inside the metadataSuccess function.  If you do this I would definitely appreciate a pull request!

Scott Haynes

unread,
Jan 22, 2014, 10:56:27 AM1/22/14
to cesiu...@googlegroups.com
Do you have a webpage that describes your pull request process?  Just create a branch with the fix and submit a PR?

Scott

Kevin Ring

unread,
Jan 22, 2014, 11:01:10 AM1/22/14
to cesiu...@googlegroups.com
That's right.  You can find more information here:

https://github.com/AnalyticalGraphicsInc/cesium/blob/master/CONTRIBUTING.md

Probably the main thing, other than what you've already said, is that we need a signed Contributor's License Agreement from you or your organization.  You can do that just by emailing it to us.  Instructions are above.  The CLA essentially says that you own your contributions and that we're allowed to use them.

Thanks for doing this!

Kevin

Chris Cooper

unread,
Jan 22, 2014, 4:24:53 PM1/22/14
to cesiu...@googlegroups.com
In case it hasn't been tried, you may be able to do this without code logic by changing hardcoded URLs in Cesium to this form...

//dev.virtualearth.net

as is common practice when using CDNs...

http://blog.jonathanoliver.com/2010/09/http-and-https-with-google-cdn/

Please let us know how you go.

Kevin Ring

unread,
Jan 22, 2014, 6:30:54 PM1/22/14
to cesiu...@googlegroups.com
Ah, yes, I always forget about that trick.  Good idea.  We'll still need the hack to modify the URLs coming back from the Bing Maps metadata service, though, since those have http hardcoded.  But rather than changing http to https, we should remove the "http:" entirely.
Reply all
Reply to author
Forward
0 new messages