App for Cloudflare® Pro

App for Cloudflare® Pro 1.8.6

Several errors

Ya… so you could do a redirect for URIs that start with upload/20 I’d think?

That would cover media uploaded after 1999 and hopefully a third party plugin isn’t prefixed with “20”?
 
Ya… so you could do a redirect for URIs that start with upload/20 I’d think?

That would cover media uploaded after 1999 and hopefully a third party plugin isn’t prefixed with “20”?
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 that’s not going to work for old/legacy media if you sometimes store it in the root of the folder.
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?
In my case I think a workaround would be to disable redirects if the file requested is a subfolder under /upload/ folder.

So, two redirect rules can be set depending on each case.
 
You can use R2, it's just an issue of if you are wanting to redirect legacy/old media. Even if you didn't put old media into R2, you could use it going forward (no redirects needed because they never existed at an old URL). If you want to use R2 for old/already existing media and want to redirect the old URLs, maybe the best option would be to redirect everything *except* URIs that start with certain strings (folders that are for third-party plugins)?

For example you could do an expression to logic if the redirect happens along the lines of:

not starts_with(lower(http.request.uri.path), "/uploads/some_plugin1/") and not starts_with(lower(http.request.uri.path), "/uploads/some_plugin2/")
 
For example you could do an expression to logic if the redirect happens along the lines of:
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
 
I'm worried many files weren't moved to R2 and there was no error log for those failed (not sure if they were missed or really failed). Is there any way to re-run the file sync and reupload the missing files?
 
But they are in the local filesystem now due to backup restoration, right?
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.
What makes it worse is the original files were removed so there is no way to know they failed to be uploaded unless you search the website looking for broken images
 
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.
 
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.
Got it, looking forward to test the new version and help you to figure out if it works :)
 
Back
Top