I swear this was not happening before but it is now. The header tags when referencing image urls for things like og:image are rendering like so:

//assets.sitename.com//assets.sitename.com/sites/default/files/video_embed_field_thumbnails/youtube/youtubeid.jpg

This issue is not occurring anywhere else.

As a work around I have blacklisted the following:

*files/video_embed_field_thumbnails/*

This is not related to the module: video_embed_field as I see this on standard image fields as well.

Any help or guidance would be greatly appreciated.

Comments

glynster created an issue. See original summary.

Wim Leers’s picture

Category: Bug report » Support request
Priority: Major » Normal
Status: Active » Postponed (maintainer needs more info)
  1. Which version of the CDN module are you using?
  2. What are your settings?
  3. What is Metatag token?
glynster’s picture

Thanks for your quick response.

1. CDN v7.x.2.8
2. Settings:

Details

Other

  • Enable duplicate content prevention (checked)
  • CDN User Agents: Amazon Cloudfront, Akamai

Exceptions

Blacklist:
sites/all/modules/admin_menu/*
*files/video_embed_field_thumbnails/*
*files/class/*

Blacklist from modules:
image_captcha*
*simpletest/verbose/*

Drupal Path

Blacklist:
nothing

Drupal path for authenticated users

Blacklist:
admin*

3. The module I was referring to is "Metatag": https://www.drupal.org/project/metatag

Let me know what else I can supply please.

Wim Leers’s picture

Thanks!

  1. Can you show the output of that <meta> tag in the <head> of the HTML with and without the CDN module?
  2. Can you confirm that it's the metatag_opengraph module that you're using?

(I started looking at http://cgit.drupalcode.org/metatag/tree/metatag_opengraph to find the culprit, but without the above information, I'm not sure whether that's the right place to start digging.)

glynster’s picture

OK good news I think to help identity the issue.

When we include https://assets.sitename.com in both Details/Other sections the metatags are correctly rendered in the head like so:

<link href="https://assets.sitename.com/sites/default/files/class/filename.jpg" rel="image_src">
<meta content="https://assets.sitename.com/sites/default/files/class/filename.jpg" property="og:image">

However when the above issue occurred we were using //assets.sitename.com in both Details/Other sections metatags are incorrectly rendered in the head like so:

<link href="//assets.sitename.com//assets.sitename.com/sites/default/files/class/filename.jpg" rel="image_src">
<meta content="//assets.sitename.com//assets.sitename.com/sites/default/files/class/filename.jpg" property="og:image">

Without the CDN module the head reads:

<link href="https://www.sitename.com/sites/default/files/class/filename.jpg" rel="image_src">
<meta content="https://www.sitename.com/sites/default/files/class/filename.jpg" property="og:image">

To confirm using the full url inside Details/Other resolves the problem.

Wim Leers’s picture

Ahh! Yes, this is why the port of the CDN module in Drupal 8 moves to protocol-relative URLs in ALL use cases.

So you have two options:

  1. In the Other section you should only check the CDN supports HTTPS checkbox, and not provide a custom mapping. It will change any http:// to https:// automatically.
  2. Alternatively, you can just enter the protocol-relative URL in Details, and not check the CDN supports HTTPS checkbox.

Did that solve your problem?

glynster’s picture

Great! 1 resolved the issue, the second option did not. By using option 2 the url was reverted back to not using the CDN and you cannot use a relative url otherwise https: is not added.

Again thanks for the prompt help in resolving our issue!

Wim Leers’s picture

Status: Postponed (maintainer needs more info) » Fixed

Ah right, I guess the D7 module doesn't really support protocol-relative CDN URLs. Wim--. This is why I made the D8 module much more strict, so that such edge cases cannot happen anymore.

Glad that helped :)

Status: Fixed » Closed (fixed)

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