css in /uploads/ breaks site because it does not copy to R2

sjamaan

New member
I'm using Woodmart theme.
We are running into an issue with the css files which are written to domain.com/uploads/sites/9/2026/1
When we save the theme settings, it writes new css files to this directory. But this is not automatically copied to R2.
The site then fails to load css files. Its probably looking for the css files on 2 because of the redirect from uploads to R2,
So the site breaks again until I manually download the css files and upload it to R2.

How do I fix this so it automatically copies css to R2?
 
I'm using Woodmart theme.
We are running into an issue with the css files which are written to domain.com/uploads/sites/9/2026/1
When we save the theme settings, it writes new css files to this directory. But this is not automatically copied to R2.
The site then fails to load css files. Its probably looking for the css files on 2 because of the redirect from uploads to R2,
So the site breaks again until I manually download the css files and upload it to R2.

How do I fix this so it automatically copies css to R2?
WordPress does not have an abstracted filesystem, so it's not possible to automatically know if anything is put into the /uploads/ folder simply by it being put there by some process or function. The R2 functionality is based on WordPress Media being uploaded. If the CSS file is uploaded as a media item, it can go to R2 automatically, if it's not media (as far as being in the WordPress Media area of the admin, it won't go to the R2 bucket).

If the underlying issue is that you have a Cloudflare redirect rule covering the entire uploads folder (but you have things in there besides Media), it probably makes sense to make that redirect rule not trigger if certain criteria are met (for example is the URI ends in .css)?
 
Back
Top