[DigitalPoint] App for Cloudflare®

[DigitalPoint] App for Cloudflare® 1.8.4.1

No permission to download
Personally I would use it if you aren’t using presigned URLs. But the benefit isn’t really much if you use presigned URLs…
Oh no! I'm getting an unauthorized error now on all attachments and media gallery links. What may be causing this? ANd yes I'm using pre-signed URLs (switched it on and cleared cache)
 
Not sure… presigned URLs are on a different domain (a Cloudflare one). Can you post a screenshot or something that shows it? Hard to say what’s going on without knowing where the error is actually coming from.
 
Hmmmm… do you have a URL I can look at where it’s happening?
 
I had the server IP as the only available IP. Oops. It is fixed now. Thank you @digitalpoint !!!!!
 
Okay so ya... Presigned URLs are effectively allowing end users to use your API token (in a secure/safe way so they don't need the actual token), but it does appear that presigned URLs won't work if the request (from a user) is made via an IP address you haven't whitelisted.

Long story short is if you want to enable presigned URLs, remove IP address restrictions from your API token. I'm going to add a note about it in the next version because it was news to me...
 
I lost like 200k image attachments due to the incompatibility of Image Optimizer from TH and BD attachments addons several years ago.
After this addon's recent update, every few minutes I get something like this logged.

PHP:
Server error log
League\Flysystem\FileNotFoundException: File not found at path: attachments/4308/4308318-70b47fb69477e5ccae5ae7b595480434.data src/vendor/league/flysystem/src/Filesystem.php:389

Generated by: Unknown account Aug 26, 2023 at 12:41 PM

Stack trace
#0 src/vendor/league/flysystem/src/Filesystem.php(194): League\Flysystem\Filesystem->assertPresent('attachments/430...')
#1 [internal function]: League\Flysystem\Filesystem->readStream('attachments/430...', Array)
#2 src/vendor/league/flysystem-eventable-filesystem/src/EventableFilesystem.php(431): call_user_func_array('League\\Flysyste...', Array)
#3 src/vendor/league/flysystem-eventable-filesystem/src/EventableFilesystem.php(395): League\Flysystem\EventableFilesystem\EventableFilesystem->callFilesystemMethod('readStream', Array)
#4 src/vendor/league/flysystem-eventable-filesystem/src/EventableFilesystem.php(154): League\Flysystem\EventableFilesystem\EventableFilesystem->delegateMethodCall('readStream', Array)
#5 src/vendor/league/flysystem/src/MountManager.php(345): League\Flysystem\EventableFilesystem\EventableFilesystem->readStream('attachments/430...')
#6 src/XF/Pub/View/Attachment/View.php(25): League\Flysystem\MountManager->readStream('attachments/430...')
#7 src/XF/Mvc/Renderer/AbstractRenderer.php(91): XF\Pub\View\Attachment\View->renderRaw()
#8 src/XF/Mvc/Renderer/Raw.php(39): XF\Mvc\Renderer\AbstractRenderer->renderViewObject('XF:Attachment\\V...', '', Array)
#9 src/XF/Mvc/Dispatcher.php(460): XF\Mvc\Renderer\Raw->renderView('XF:Attachment\\V...', '', Array)
#10 src/XF/Mvc/Dispatcher.php(442): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Raw), Object(XF\Mvc\Reply\View))
#11 src/XF/Mvc/Dispatcher.php(402): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Raw), Object(XF\Mvc\Reply\View))
#12 src/XF/Mvc/Dispatcher.php(60): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'raw')
#13 src/XF/App.php(2487): XF\Mvc\Dispatcher->run()
#14 src/XF.php(524): XF\App->run()
#15 index.php(20): XF::runApp('XF\\Pub\\App')
#16 {main}

Can I make the error logging silent?
Or maybe I need to prune the database entry if the attachment file isn't present anymore?
 
I lost like 200k image attachments due to the incompatibility of Image Optimizer from TH and BD attachments addons several years ago.
After this addon's recent update, every few minutes I get something like this logged.

PHP:
Server error log
League\Flysystem\FileNotFoundException: File not found at path: attachments/4308/4308318-70b47fb69477e5ccae5ae7b595480434.data src/vendor/league/flysystem/src/Filesystem.php:389

Generated by: Unknown account Aug 26, 2023 at 12:41 PM

Stack trace
#0 src/vendor/league/flysystem/src/Filesystem.php(194): League\Flysystem\Filesystem->assertPresent('attachments/430...')
#1 [internal function]: League\Flysystem\Filesystem->readStream('attachments/430...', Array)
#2 src/vendor/league/flysystem-eventable-filesystem/src/EventableFilesystem.php(431): call_user_func_array('League\\Flysyste...', Array)
#3 src/vendor/league/flysystem-eventable-filesystem/src/EventableFilesystem.php(395): League\Flysystem\EventableFilesystem\EventableFilesystem->callFilesystemMethod('readStream', Array)
#4 src/vendor/league/flysystem-eventable-filesystem/src/EventableFilesystem.php(154): League\Flysystem\EventableFilesystem\EventableFilesystem->delegateMethodCall('readStream', Array)
#5 src/vendor/league/flysystem/src/MountManager.php(345): League\Flysystem\EventableFilesystem\EventableFilesystem->readStream('attachments/430...')
#6 src/XF/Pub/View/Attachment/View.php(25): League\Flysystem\MountManager->readStream('attachments/430...')
#7 src/XF/Mvc/Renderer/AbstractRenderer.php(91): XF\Pub\View\Attachment\View->renderRaw()
#8 src/XF/Mvc/Renderer/Raw.php(39): XF\Mvc\Renderer\AbstractRenderer->renderViewObject('XF:Attachment\\V...', '', Array)
#9 src/XF/Mvc/Dispatcher.php(460): XF\Mvc\Renderer\Raw->renderView('XF:Attachment\\V...', '', Array)
#10 src/XF/Mvc/Dispatcher.php(442): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Raw), Object(XF\Mvc\Reply\View))
#11 src/XF/Mvc/Dispatcher.php(402): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Raw), Object(XF\Mvc\Reply\View))
#12 src/XF/Mvc/Dispatcher.php(60): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'raw')
#13 src/XF/App.php(2487): XF\Mvc\Dispatcher->run()
#14 src/XF.php(524): XF\App->run()
#15 index.php(20): XF::runApp('XF\\Pub\\App')
#16 {main}

Can I make the error logging silent?
Or maybe I need to prune the database entry if the attachment file isn't present anymore?
It’s actually an intentional change with the new version… before it would throw an error to the user but not to the error log (admin was never notified to rectify). Now it’s the same for end users (they still see an error about the attachment not being able to be viewed), but it also lets an admin know via the error log.

It would be easy enough to revert to just showing the error to users but not admin, but it’s probably not a bad idea to address the underlying issue so users don’t get errors.

But ya, it will happen if there’s an attachment, but the attachment data (the file itself) is missing. If you don’t have a way to restore the data, I would think it would make sense to delete the attachment so users don’t getting errors about it not being available to be viewed (missing data/underlying file).
 
It would be easy enough to revert to just showing the error to users but not admin
In the meantime, How do I revert the changes (disabling the error log)?
I am now getting 5–10 errors every minute.

Edit: I'm not using R2, by the way.
 
Last edited:
Rollback isn't supported; I guess you mean to uninstall the add-on and install it again.
But custom add-on options will be lost.
 
Rollback isn't supported; I guess you mean to uninstall the add-on and install it again.
But custom add-on options will be lost.
It’s not? Dumb…

If you have development mode enabled, you could disable the class extension for XF\Entity\AttachmentData
 
  • Love
Reactions: rdn
Another option would be to enable the new presigned URLs. Since that works by sending the user’s HTTP request straight to where the file should be, I think that would work too since the file missing error would be limited to client-side (user’s side), so that should in theory be the same net result (error for the user, no error for admin).

That’s in theory anyway, I don’t have attachments with missing data to actually test it on, but since the user is redirected before the server tries to fetch the data, I think that should work as well.
 
Another option would be to enable the new presigned URLs. Since that works by sending the user’s HTTP request straight to where the file should be, I think that would work too since the file missing error would be limited to client-side (user’s side), so that should in theory be the same net result (error for the user, no error for admin).
Even if I'm not using R2?
I'm still using the default XF attachment location.
 
If you have R2, should Edge cacheing for attachments be on?
Personally I would use it if you aren’t using presigned URLs. But the benefit isn’t really much if you use presigned URLs…
I was going to suggest that you add that info to your OP here https://xenforo.com/community/threads/cloudflare-optimizations-for-xenforo.210792/. But then I remembered that this forum doesn't allow you to edit posts after 24 hours. It may be useful to instead add it (and other similar tips) to the main page here https://xenforo.com/community/resources/app-for-cloudflare®.8750/ (above the "edge caching" screenshot?)

EDIT:
Also, I saw "rolling back of addons" mentioned as well. Yet that doesn't seem to be an available option? I found this thread confirming that it's not possible in XF 1.x.
 
Last edited:
Top Bottom