I am working on a project with Laravel and Livewire, using DDEV as the development environment. I have a Livewire component that allows users to upload an image and display a temporary preview before it is saved.
Here is the code I’m using:
<div>
<input type="file" wire:model="imagen" />
@if ($imagen)
<img src="{{ $imagen->temporaryUrl() }}" alt="Alt" srcset="">
@endif
</div>
The problem is that when I select an image, instead of displaying the preview, I get a 404 error. Here’s the full error message from the console:
Failed to load resource: the server responded with a status of 404 ()
https://proj-mesadepartes-sanroman.ddev.site/livewire/preview-file/peSbbMuKB7ldqBZgZlR5lpAEv4Zp9M-metaaW1nLnBuZw==-.png?expires=1725555599&signature=2845bd44d7be5bd1e4f64fe07845f700009de5b5a291f72c63211da12008fc81
It seems that DDEV cannot correctly handle temporary URLs generated by Livewire. Has anyone else encountered this issue? Is it possible that DDEV has some limitation when dealing with temporary images? If so, is there a solution or specific configuration I should adjust?
I would greatly appreciate any guidance or suggestions.
Thank you in advance!
Additionally, I reviewed the DDEV documentation and also ran the following command:
php artisan storage:link
3