CDN module rewrites already rewritten protocol-relative URLs
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #1466102. --> Reported by: [skwashd](https://www.drupal.org/user/116305) >>> <p>If my CDN server URL is //cdn.example.com/ when using image fields the image URL becomes //cdn.example.com//cdn.example.com/sites/default/files/my-image.png because image field generates the URL to the image which is fed through cdn_file_url_alter(), later the output html is fed through cdn_html_alter_image_urls() which also failed to take into account protocol relative URLs.</p> <p>The first problem really lies in Drupal core's file_uri_scheme() as it doesn't understand protocol relative URLs, but I don't have the energy to have that fight atm. Instead I decided to add an extra condition to the protocol check in CDN to catch it.</p> <p>The second problem is caused by the page wide image replacement which checks for base_path() as one of the patterns, so // matches when drupal is installed in the docroot (common use case for people wanting to use a CDN).</p> <p>Patch coming right up.</p>
issue