Hello,

I detected this in one installation of mine. The thing is very simple: when you have a secure proxy server in front of your application server, both exchanging data through port 80, the way it tries to get the configuration about https use (via $GLOBALS) won't work, since for the application server the port is still 80. As the front-end server is using SSL port to transmit data to visitants, we get the mixed content error when loading gpt.js library file (because it tries to get it from -> http://www.googletagservices.com, not https://), and nothing works.

My proposed solution is to change at line 684 from dfp.module file, from:

drupal_add_js(($GLOBALS['is_https'] ? "https://" : "http://") . DFP_GOOGLE_TAG_SERVICES_URL, $options);

to

drupal_add_js("//" . DFP_GOOGLE_TAG_SERVICES_URL, $options);

letting it free to the users' browser to match the protocol.

Comments

Vuds created an issue. See original summary.

Vuds’s picture

Issue summary: View changes
Patrick Ryan’s picture

Status: Active » Needs review
StatusFileSize
new618 bytes

I can confirm this is an issue. The solution suggested above is correct - here's a patch for it. Tested on AWS instances behind a proxy.

camerongreen’s picture

I had this issue as well, agree with the fix. Will try something like this in the meantime:

/**
 * Implements hook_js_alter().
 */
function mymodule_js_alter(&$javascript) {
  if (array_key_exists('http://' . DFP_GOOGLE_TAG_SERVICES_URL', $javascript)) {
    $orig = $javascript['http://' . DFP_GOOGLE_TAG_SERVICES_URL];
    unset($javascript['http://' . DFP_GOOGLE_TAG_SERVICES_URL]);
    $orig['data'] = '//' . DFP_GOOGLE_TAG_SERVICES_URL;
    $javascript['//' . DFP_GOOGLE_TAG_SERVICES_URL] = $orig;
  }
}
bleen’s picture

@camerongreen, have you tried the patch in #3? If so, can you report back success or failure. I think its a perfectly good solution but Id like someone to test and mark this issue as RTBC before merging it in.

camerongreen’s picture

@bleen our module had other patches applied to it, so the above fix was manually applied and it fixed the problem. So I can't verify the patch, but I can verify that what it is intended to do works well.

With the recent sec advisory about the module, I needed to upgrade it so I'm moving patches out into hooks as per my message above. Stops me having to reapply them on upgrades etc.

acrosman’s picture

Status: Needs review » Reviewed & tested by the community

The patch from #3 applied cleaning and worked for me. Patch itself seems simple enough and should solve the problem reliably.

dpi’s picture

+1 RTBC.

Resolved a Cloudfront issue.

  • bleen committed 7246913 on 7.x-1.x authored by Patrick Ryan
    Issue #2825725 by Patrick Ryan: GPT.js won't load if system is...
bleen’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.