Page MenuHomePhabricator

Error with loading OpenLayers code
Closed, ResolvedPublic

Description

I get this error on Firefox when trying to

Blocked loading mixed active content “http://openlayers.org/api/OpenLayers.js”
<script> source URI is not allowed in this document: “https://www.openlayers.org/api/OpenLayers.js”.

So tried changing CargoOpenLayersFormat.php to use HTTPS, but then got:

Loading failed for the <script> with source “https://www.openlayers.org/api/OpenLayers.js”.

Which is rather weird.

This is with Cargo 79e4121 and with this template: https://archives.org.au/Template:Place

Is there the possibility of bundling openlayers with the extension?

Details

Related Gerrit Patches:
mediawiki/extensions/Cargo : masterUse protocol-relative URLs for OpenLayers and OSM

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 29 2018, 11:35 AM

@Samwilson

Loading failed for the <script> with source “https://www.openlayers.org/api/OpenLayers.js”.

I am not sure why you should be getting that (one of the reasons may be that “https://www.openlayers.org/api/OpenLayers.js ” actually redirects to "http://openlayers.org/api/OpenLayers.js " ).

Change the link to "https://openlayers.org/api/OpenLayers.js " instead of "https://www.openlayers.org/api/OpenLayers.js". It should work.

The problem with the non-HTTPS one is that I then get the Blocked loading mixed active content “http://openlayers.org/api/OpenLayers.js” error.

you need to change the link to "https://openlayers.org/api/OpenLayers.js "(openlayers must be without www, otherwise it will again redirect to “http://openlayers.org/api/OpenLayers.js ” )

Gosh, thank you, I feel quite inobservant! :-) I've fixed it up, and that error is now gone.

Unfortunately, other assets are being loaded via HTTP now:

Loading mixed (insecure) display content “http://c.tile.openstreetmap.org/17/107698/77830.png” on a secure page

Which I guess can be fixed in ext.cargo.maps?

I'd submit a patch, but I'm not sure if openlayers should be bundled, or there should be an option of using the CDN, or what.

I don't think it can be fixed in ext.cargo.maps because these links are called by OpenLayers.js.
I found a discussion related to this, it may be somewhat helpful: https://gis.stackexchange.com/questions/83953/openlayers-maps-issue-with-ssl

Change 423588 had a related patch set uploaded (by Samwilson; owner: Samwilson):
[mediawiki/extensions/Cargo@master] Use protocol-relative URLs for OpenLayers and OSM

https://gerrit.wikimedia.org/r/423588

Change 423588 merged by jenkins-bot:
[mediawiki/extensions/Cargo@master] Use protocol-relative URLs for OpenLayers and OSM

https://gerrit.wikimedia.org/r/423588

Samwilson closed this task as Resolved.Apr 3 2018, 1:55 AM
Samwilson claimed this task.

That was quick Yaron! :) Thanks.

All is working correctly now, in my testing.