Background Images Paths are Changed when CSS Aggregation is On

s3fs module with AdvAgg to store CSS/JS aggregates on the S3 stream wrapper

Without Aggregation (Works well). fetch from domain base url.

background-image: url(/themes/THEME/images/test.jpg);

Src of the image in CSS, which is pointing to the CNAME for S3

With Aggregation isn't working. Because, my CNAME is different from my DOMAIN name.

background-image: url(http://CNAME_DOMAIN/themes/THEME/images/test.jpg);

I disabled it all OBSCURE options(admin/config/development/performance/advagg). But No luck.

Everytime, the CSS file content url() fetching from the CNAME url.

1 Answer 1


I found the same issue and it was the absolute path that broke things https://www.drupal.org/project/s3fs/issues/3241554

Had a very similar structure:

background-image: url(/themes/THEME/images/test.jpg);

Convert this to:

background-image: url(/../images/test.jpg);

(Or whatever relative path that makes sense) and it should work (thanks to @cmlara for the pointer!)

  • Still, i have same issue. Commented Sep 15, 2022 at 11:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.