Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
when I'm on an https page in Chrome (and occasionally in Firefox) I am thrown a console error about a protocol mismatch. The maps.googleapis.com/maps/api/js?sensor=false script is blocked because of insecure content.
perhaps the protocol can be stripped from line 323 and 328 of google_map_field.module. I've tested this in chrome, safari, FF, and IE (9 & 10).
function google_map_field_add_maps_api() {
if (variable_get('google_map_field_apikey', '') != '') {
$element = array(
'#type' => 'markup',
'#markup' => '<script type="text/javascript" src="//maps.googleapis.com/maps/api/js?sensor=false&key=' . variable_get('google_map_field_apikey', '') . '"></script>',
);
drupal_add_html_head($element, 'google_maps_api');
}
else {
drupal_add_js('//maps.googleapis.com/maps/api/js?sensor=false', 'external');
}
}
Comment | File | Size | Author |
---|---|---|---|
#4 | protocol-mismatch-2040173-4.patch | 546 bytes | matej.lehotsky |
#1 | protocol-mismatch-2040173-1.patch | 1004 bytes | willito |
Comments
Comment #1
willito CreditAttribution: willito commenteda patch with the above change
Comment #2
scot.hubbard CreditAttribution: scot.hubbard commentedPlease upgrade to version 7.x-2.4
Comment #3
matej.lehotsky CreditAttribution: matej.lehotsky commentedWith some ngnix server configuration is current protocol detection insufficient. Please use something like this instead...
Comment #4
matej.lehotsky CreditAttribution: matej.lehotsky commentedComment #5
scot.hubbard CreditAttribution: scot.hubbard commentedHi raweez
I have committed your patch to the current dev snapshot. Once it is available, feel free to close this ticket, or mark as tested and I'll make another stable release.
Comment #7
matej.lehotsky CreditAttribution: matej.lehotsky commentedComment #8
arne_hortell CreditAttribution: arne_hortell commentedIn my case it should be like this
function google_map_field_get_protocol() {
return (!empty($GLOBALS['base_root']) && strpos($GLOBALS['base_root'],'https://')==0) ? "https://" : "http://";
}
Reason is because if working below a load balancer, everything set in $_SERVER is according to loadbalancer but base_root is not.