F
Filament8mo ago
player

Spatie Livewire File Uploads 401 on server

Hello everyone! I'm using Filament 3.x and Spatie Media Library + docker compose. On the local env everything is ok, but on the server I has 401 error while uploading files via upload-file?expires=1713776933&signature=6e883bc3f42d1117c5ceee6994d857a0f4df044c55f608a86619e2c0d97ad817 Googled it, but didn't find working solution. Any tips?
Solution:
I added
if($this->app->environment('production')) { URL::forceScheme('https'); request()->server->set('HTTPS', request()->header('X-Forwarded-Proto', 'https') == 'https' ? 'on' : 'off'); }...
Jump to solution
11 Replies
krekas
krekas8mo ago
my guess permissions problems
player
playerOP8mo ago
Why there are 401 then? App didn't even reach file permissions step. No exceptions in logs
krekas
krekas8mo ago
file permissions
player
playerOP8mo ago
It should be exception then
krekas
krekas8mo ago
what exception? fix permissions on your file system
player
playerOP8mo ago
It should not respond 401 if the problem is connected with file permissions. If so, app would throw an exception in logs. It seems that it doesn't reach the point to upload file. https://github.com/livewire/livewire/discussions/3084 Look this issue please
GitHub
File upload over https fails signature verification · livewire live...
Fille uploads doesn't work over https, whereas it works perfectly over http Set up livewire file upload, then use https (e.g. with ngrok) the upload fails with the request to Request URL: https...
player
playerOP8mo ago
And also it's 777 on storage folder now
krekas
krekas8mo ago
then it might be some misconfiguration of your docker
player
playerOP8mo ago
But it works in local environment
Solution
player
player8mo ago
I added
if($this->app->environment('production')) { URL::forceScheme('https'); request()->server->set('HTTPS', request()->header('X-Forwarded-Proto', 'https') == 'https' ? 'on' : 'off'); } to AppProvider, but now I have another issue - uploaded photos don't show - they try to get url from localhost instead of my server domain
player
playerOP8mo ago
Solved: config/filesystems.php set to public and clear caches
Want results from more Discord servers?
Add your server