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.
The DNS Prefetch meta tag is being generated as
<link rel="dns-prefetch" href="//img1.mycdn.com http" />
I believe this should be
<link rel="dns-prefetch" href="http://img1.gusagusa.com" />
Not sure if its an allowed format or the url is being malformed. Happening on 2 individual sites that use CDN module for a sub-domain cdn
Comment | File | Size | Author |
---|---|---|---|
#7 | cdn-malformed-dns-prefetch-1826816.diff | 481 bytes | saitanay |
Comments
Comment #1
Wim LeersThat's actually correct; it's a protocol-relative URL :) (Makes sure it always works, for HTTP- and HTTPS-served pages; prevents mixed content warnings.)
See e.g. http://paulirish.com/2010/the-protocol-relative-url/
Comment #2
Wim LeersComment #3
Wim LeersComment #4
saitanay CreditAttribution: saitanay commentedwell, just one clarification
i understand that avoiding http before the url is fine.
but placing the same at the end of the url, separated by a space, is it also designed so? i could not find any example in such format, nor in the provided link. Apologoes in advance if this is not a bug.
<link rel="dns-prefetch" href="//img1.mycdn.com http" />
the "http" after mycdn.com is what i am talking about,.
Comment #5
saitanay CreditAttribution: saitanay commentedcdn mapping
http://img1.mydomain.com http://img2.mydomain.com http://img3.mydomain.com|.css .jpg .jpeg .png .gif
Comment #6
saitanay CreditAttribution: saitanay commenteddid some debugging
the trailing http is being addded to the domain here at
This happens when there are multiple domains mentioned in the same line
Either the code must be modified to handle multiple domains in the same line or the documentation in advanced_help should be updated , removing the example of mentioning multiple domains in same line
Quote from advanced help of cdn module
As mentioned in the above advanced_help, if the below format is used, then the http from the second domain is being added to the end of first domain and the dns prefetch tag is shown incorrect..
http://cdn-b.com http://cdn-c.com|.jpg .jpeg .png
Comment #7
saitanay CreditAttribution: saitanay commentedattached is a patch to the advanced help
its an svn diff though
Comment #8
Wim Leers#4: wow, no, that's definitely a bug. But I'm not seeing that on either http://wimleers.com (D7) nor http://driverpacks.net (D6).
Congrats, you've found a bug. I'll make sure to add a unit test for this.
Comment #9
Wim LeersComment #10
saitanay CreditAttribution: saitanay commented//#4: wow, no, that's definitely a bug. But I'm not seeing that on either http://wimleers.com (D7) nor http://driverpacks.net (D6).
I believe you are not seeing the issue on mentioned sites because they have the domains mapped in multiple lines
The issue seems to happen when there is more than 1 domain in each line of the CDN mapping ,. example:
http://img1.mydomain.com http://img2.mydomain.com http://img3.mydomain.com|.css .jpg .jpeg .png .gif
This can be avoided by
This could be either fixed in the code,. or the advanced help could be updated removing the example of mapping multiple domains in single line
Comment #11
Wim LeersYep, as I said, you've found a bug. I should've worded it more clearly. I'm going to add a unit test to reproduce it and to ensure no regressions occur. Thanks for the detailed report! :)
If you want to fix this as fast as possible, please contribute a unit test!
Comment #12
Wim LeersSo… this was actually already fixed in 7.x-2.x a long time ago, along with extensive tests. :) Upgrade to the dev snapshot or to the upcoming 2.6 release and you won't experience this again
Specifically, it was fixed in this commit: http://drupalcode.org/project/cdn.git/commitdiff/63537efafdc6d345a30c11b....
See #1593930: cdn_get_domains() is broken for auto-balancing when using protocol-relative domains: fix + tighten tests.
Comment #12.0
Wim LeersAdd code tags.