Search code examples
google-mapssslkmlself-signed

Cannot display KML in Google Maps when using SSL to host the KML


I'm developing a web application in a testing environment. Since it's required to use SSL when going live, we created a self-signed certificate for the test environment.

We do use Google Maps APIs for Javascript

<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>

Often I need to display a KML layer which is generated by our webapp. So basically I issue

ctaLayer = new google.maps.KmlLayer(
{
    url: theURL
});
ctaLayer.setMap(me.map);

The problem is very simple: though KML is valid, when the URL points to the HTTPS version of our test site, Google Maps won't display the KML. Our production environment is not supposed to work with HTTP at all (you get always redirected to port 443), so since switching KMLs URLs to HTTP is not a viable option unless the only, I would like to ask: is it a problem with the certificate?

  • Can I tell Google Maps to accept untrusted contents?
  • Buying a certificate for the test environment (production will have a trusted certificate) will 100% fix the problem?

Solution

  • As far as I have found, Google Maps works with verified SSL certificates