You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Storage driver: Cloudflare R2 (S3 compatible via league/flysystem-aws-s3-v3 ^3.0)
Disk visibility:private
Description
I'm experiencing a strange issue where getTemporaryUrl() generates URLs that work on most devices but fail on my mobile device. Here's the current status across different devices with the same account:
✅ Ubuntu Desktop - Works
✅ MacBook Pro 1 - Works
✅ MacBook Pro 2 - Works now (but initially had the same issue as mobile)
✅ Live environment on all devices except my mobile - Works
❌ My mobile device (same account and environment) - Does NOT work
// config/media-library.php'disk_name' => env('MEDIA_DISK', 'public'), // Set to 'r2' in production'temporary_url_default_lifetime' => env('MEDIA_TEMPORARY_URL_DEFAULT_LIFETIME', 5),
Expected Behavior
Temporary URLs generated by getTemporaryUrl() should load images consistently across all devices and browsers, including mobile phones.
Actual Behavior
Desktop: Images load immediately without any issues
Mobile: Images fail to load (XML Access Denied page)
Same user account, same application, same network (or different networks) - still fails on mobile
Steps to Reproduce
Set up Laravel application with Media Library
Configure Cloudflare R2 as storage driver with visibility => 'private'
Upload media to a model using Media Library
Generate temporary URL using getTemporaryUrl(expiration: now()->addMinutes(60))
Try accessing the URL from:
Desktop browser (works)
Mobile browser (fails)
Troubleshooting Attempts
✅ Verified the URLs are identical on both desktop and mobile
✅ Confirmed it's not a network issue (tried WiFi and mobile data)
✅ Tried different browsers on mobile
✅ Checked that the expiration time is sufficient (60 minutes)
✅ Verified R2 credentials and permissions are correct
✅ Tested with fresh browser sessions (incognito mode)
✅ Cleared cloudflare and browser cache
Additional Context
This is particularly puzzling because:
The same URL works perfectly on most devices (Ubuntu, MacBook Pro 1 & 2) but not on my mobile device
It's not browser-specific on mobile (fails on all mobile browsers)
It's not network-specific (fails on both WiFi and cellular)
The signature should be device-agnostic
Could this be related to:
Cloudflare R2's handling of mobile requests?
Signature validation differences on the R2 side based on request origin?
Browser caching or SSL certificate validation on mobile?
Possible Related Issues
This might be related to how AWS S3 (and by extension R2) generates and validates signed URLs, but I couldn't find any documentation suggesting that mobile devices should be treated differently.
This discussion was converted from issue #3870 on November 12, 2025 10:13.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Environment
spatie/laravel-medialibrary^11.17league/flysystem-aws-s3-v3^3.0)privateDescription
I'm experiencing a strange issue where
getTemporaryUrl()generates URLs that work on most devices but fail on my mobile device. Here's the current status across different devices with the same account:Code Example
Configuration
Filesystem Config (R2 disk)
Media Library Config
Expected Behavior
Temporary URLs generated by
getTemporaryUrl()should load images consistently across all devices and browsers, including mobile phones.Actual Behavior
Steps to Reproduce
visibility => 'private'getTemporaryUrl(expiration: now()->addMinutes(60))Troubleshooting Attempts
Additional Context
This is particularly puzzling because:
Could this be related to:
Possible Related Issues
This might be related to how AWS S3 (and by extension R2) generates and validates signed URLs, but I couldn't find any documentation suggesting that mobile devices should be treated differently.
Beta Was this translation helpful? Give feedback.
All reactions