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?
[blocked] The page at ‘https://virtualworldframework.com/agi/cesium/00c9659423a6533d/’ was loaded over HTTPS, but ran insecure content from ‘http://dev.virtualearth.net/REST/v1/Imagery/Metadata/Aerial?key=AkMnCOd4RF1U7D7qgdBz3Fk1aJB3rgCCI_DO841suDGxqOg0SMICTE8Ivy5HhAf5&jsonp=jsonp847160’: this content should also be loaded over HTTPS.
An error occurred in “r”: cesium.js:715
An error occurred while accessing http://dev.virtualearth.net/REST/v1/Imagery/Metadata/Aerial?key=AkMnCOd4RF1U7D7qgdBz3Fk1aJB3rgCCI_DO841suDGxqOg0SMICTE8Ivy5HhAf5. cesium.js:715
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.
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.
Yep, that was the first thing I tried. Sadly the imageryUrl returned in the metadata response is still http.
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.
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!
Do you have a webpage that describes your pull request process? Just create a branch with the fix and submit a PR?
That’s right. You can find more information here:
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!
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…
as is common practice when using CDNs…
Please let us know how you go.
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.