yup, I think that should work (and remember about redirecting the media in the root folder of /upload/ because if you have the option to not use the /year/month/ structure then Wordpress will save everything on /upload/Ya… so you could do a redirect for URIs that start withupload/20
I’d think?
That would cover media uploaded after 1999 and hopefully a third party plugin isn’t prefixed with “20”?
I have the "Organize my uploads into month- and year-based folders" option disabled so that means I won't be able to use R2 then?Ya that’s not going to work for old/legacy media if you sometimes store it in the root of the folder.
not starts_with(lower(http.request.uri.path), "/uploads/some_plugin1/") and not starts_with(lower(http.request.uri.path), "/uploads/some_plugin2/")
Oh this is actually great, I can 'whitelist' those plugin folders then.For example you could do an expression to logic if the redirect happens along the lines of:
@digitalpoint can you check this?Oh this is actually great, I can 'whitelist' those plugin folders then.
Can you give me more information where should I set that expression?
I'm not sure where to add it
Sorry, missed the message. It’s in your Cloudflare account under redirect rules. You have the option to toggle between building the rule with a UI/drodowns or with an expression.@digitalpoint can you check this?
no, they were removed from the filesystem, they weren't uploaded to R2 so I had to restore them from a backup.The files are still in the local filesystem and you just want to re-upload them all?
Yes, I have the files (luckily I took a backup) but I'm unsure about moving to R2 again if this is not fixed. Without a complete error log I can't find out what images weren't uploaded.But they are in the local filesystem now due to backup restoration, right?
Got it, looking forward to test the new version and help you to figure out if it works 🙂In this particular case, I think a better solution than just logging if something failed would be to not delete those and also not flag something as being moved to R2 if it didn't work for whatever reason.
Internally the system monitors Cloudflare's side and will retry a transfer if Cloudflare returns a 5xx error (5xx is an error on their end). However if something on the server-side (WordPress side) causes a failure it wouldn't retry since there's no real way to monitor if something happened on that end since the upload is part of that side.
I think a better solution would be to do a double check that the file landed in R2 properly (read it back after it's uploaded) to make sure it's there. That should work around any issue (Cloudflare's side or server-side) because we would only flag it as being moved if we are able to first read it from where it's supposed to be. So rather than ending up with potentially broken images that someone needs to go through an error log to locate, someone would end up with media that is still local that they could simply try again.