I am using origin pull method but most of my images and some css files are not being served through CDN. I am using the Sky theme and it uses drupal_add_css with a relative css path as input. Many of the images are linked relatively as background images in css injector. The other images are from modules like quicktabs and panels. How can I ensure everything is served through CDN?

Comments

yang_yi_cn’s picture

same here.

It looks like that the images that generated in HTML are all severed through CDN correctly.

However, background images defined in CSS files are not served at all. Those are images such as background: url("../images/btns-small.png") no-repeat scroll -101px 0 transparent;

yang_yi_cn’s picture

Title: Alot of things not being run through CDN » Background images defined by CSS are not being run through CDN

is that the way it works? or I'm misconfiguring something?

zazinteractive’s picture

I just did it manually through search and replace

larruda’s picture

I found a solution, but it means changing core code because there's no hook I searched for that intercepts the needed routine.

File: /includes/common.inc Line: 1983

Change from

return 'url('. $path .')';

To this:

return 'url('. file_create_url(substr($path, 1)) .')';

Remember to identify this part with something (eg: comment) and detect/change again that when upgrading core code.

Wim Leers’s picture

Version: 6.x-2.1 » 7.x-2.x-dev
Component: Origin Pull mode » Documentation
Assigned: Unassigned » Wim Leers
Category: support » task

#4: that even only works when you're using CSS aggregation. When you're not using CSS aggregation, it will still fail to load from the CDN.

The solution is to use the AdvAgg module. But this needs to be documented properly.

Wim Leers’s picture

Correction, you'd also have to install the http://drupal.org/project/parallel_css module. Also see #1410318: Merge into CDN module?.

Wim Leers’s picture

Status: Active » Closed (duplicate)

Found more severe problems due to this problem at #1428530: Override CSS aggregation to ensure correct file URL altering for files referenced by CSS files. This issue is now merged into that one.