CORS error using FileUpload with Laravel Sail and Share #5485
-
I have a
Running locally using The problem comes when I use the When I do this my site, which locally is at When I try to look at the images on the shared site I get the following console errors:
My .env file contains the following:
It looks like the images are being blocked by the CORS policy. I've tried to solve this by updating
After updating this file I cleared my cache with I suspect that files in storage aren't included in this, but this is where I run out of ideas. Any suggestions? |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 11 replies
-
Your APP URL needs to contain the sharing URL |
Beta Was this translation helpful? Give feedback.
-
That worked. Thanks @danharrin 😄 Now I just have to figure out how to switch the APP_URL depending on whether I'm using sail share or not. |
Beta Was this translation helpful? Give feedback.
-
Chiming in here. I'm using filamentphp in a multi-tenant setup. Filepond now only displays files if I'm accessing the site on the same domain as the Is there any way to instruct filepond to use the current url over the one configured in |
Beta Was this translation helpful? Give feedback.
-
So, the issue was this (for those reading in the future). With public local storage (in development in my case) it's required to serve the images from the same domain as the admin interface. Easiest way is to configure the
For s3 storage and the like. Ensure the external storage (like cdn.websitename.com) actually sets the cors headers. Because filepond uses a canvas and doesn't include the image with an Note that the origin is set to Question to @danharrin: shall I write a few sentences about this for the documentation? I think it would help to quickly discuss the |
Beta Was this translation helpful? Give feedback.
-
Hello, were you able to solve this issue by any chance? We have a similar issue when we are using multiple panels with domain(), and we getting an error because of a mismatch between domain URL and storage URL. Any idea how to set the storage URL in panel provider? |
Beta Was this translation helpful? Give feedback.
-
If anyone still has this issue, especially if you have multi-tenant setup, just unset APP_URL in .env file:
It works perfectly in my case. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
If anyone has this problem on localhost, definitely consider the following attempt
|
Beta Was this translation helpful? Give feedback.
Your APP URL needs to contain the sharing URL