• Resolved Agency Dominion Inc.

    (@agencydominion)


    Hello,

    After the 3.1.5 update removed the Cache Location settings and automatically used the uploads directory, our minified CSS files are now looking for linked images on S3. For example:

    background-image:url('images/image.svg');

    gets rewritten to:

    background-image:url(/wp-content/themes/any-theme/images/image.svg);

    We store uploaded images on S3 but not theme files, so this update breaks our images because the relative URL rewrite looks for the images on S3.

    Having the option to choose the Cache Location was essential to our ability to use FVM. Is is possible to restore this setting or at least to have a filter to modify the Cache Location settings?

    Is there another solution to this problem which I may be missing?

    Thank you.

Viewing 1 replies (of 1 total)
  • Plugin Author Raul P.

    (@alignak)

    This is not an issue with the cache path being rewritten, it’s the lack of absolute urls on your assets references.

    The plugin will only do that for assets that either use the same domain or have no absolute path.

    The rewrite you posted as an example is correct.
    A relative url such as background-image:url('images/image.svg'); inside a file such as /wp-content/themes/any-theme/file.css is correctly translated as background-image:url(/wp-content/themes/any-theme/images/image.svg);

    If you don’t want relative paths, then you need use absolute paths with the s3 full url on the url like background-image:url(https://your-s3-endpoint.com/wp-content/themes/any-theme/images/image.svg);

    The relative paths rewrite was designed for regular CDN usage, so when you have a CDN with origin pull, it will use the CDN url for the CSS files and then fetch all relative assets through the CDN too from the origin.

    For s3 specifically, FVM does not upload the minified css and js to s3, so you cannot use it as CDN replacement (furthermore, TTFB on s3 is terrible… so you should at least at cloudfront if you haven’t done so).

    You haven’t provided sufficient examples with css paths, and what is returning, so this is all I can tell you.

    If the generated css and js files are being open on your domain (ie: not using a cdn with origin pull), then all assets will also load from the same domain as those files. That means, you need to have those files at the origin.

    If you want to use custom urls for static assets that are not present at the origin, then you need to use absolute urls for those assets. That way, FVM will not convert them and use the defined url.

Viewing 1 replies (of 1 total)
  • The topic ‘changed the cache directory to the uploads directory update breaks CSS images’ is closed to new replies.