filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
19.28k stars 2.96k forks source link

Uploaded files not retrievable due to server not acting as a proxy #9214

Closed ibvodafoneziggo closed 1 year ago

ibvodafoneziggo commented 1 year ago

Package

filament/forms

Package Version

2.17.53

Laravel Version

10.28.0

Livewire Version

2.12.6

PHP Version

8.2

Problem description

I'm uploading a file to S3 storage that is only accessible by my server, not to the client. When I'm uploading a file it works perfectly and the file is put in the S3 bucket. When previewing the file though, the frontend tries to read the S3 bucket itself, which only the server has access to.

Forms\Components\FileUpload::make('attachments') ->disk(config('storage.driver')) ->directory(config('storage.attachements-directory')) ->visibility(config('storage.storage-bucket-visibility')) ->maxSize(config('storage.max-upload-size')) ->maxFiles(config('storage.max-file-amount')) ->enableDownload() ->multiple()

This is the configuration I'm using, where the disk is an S3 bucket and the visibility is set to private. The URL that the frontend is trying to read is the disk configuration url.

Expected behavior

I'm expecting the server to act as a proxy to retrieve the file and serve it to the client, but that doesn't seem to be configurable.

Steps to reproduce

  1. Create a form with the fileUpload component.
  2. Set the disk as an S3 bucket only accessible by the server, and not the client / webbrowser.
  3. See the preview not load because the asset gives a 404.

Reproduction repository

https://github.com/filamentphp/filament

Relevant log output

No response

github-actions[bot] commented 1 year ago

Hey @ibvodafoneziggo! We're sorry to hear that you've hit this issue. 💛

However, it looks like you forgot to fill in the reproduction repository URL. Can you edit your original post and then we'll look at your issue?

We need a public GitHub repository which contains a Laravel app with the minimal amount of Filament code to reproduce the problem. Please do not link to your actual project, what we need instead is a minimal reproduction in a fresh project without any unnecessary code. This means it doesn't matter if your real project is private / confidential, since we want a link to a separate, isolated reproduction. That would allow us to download it and review your bug much easier, so it can be fixed quicker. Please make sure to include a database seeder with everything we need to set the app up quickly.