Respect's avatar

livewire 4 preview file not working with ngnix

Hello, thanks for help in my vps when i try to choose file to upload got error in console
iam using wire:model.live in localhost ubuntu linux with lamp works100% in vps with ngnix notworking yet and show these error

/livewire-42321e45/upload-file?expires=1782958309&signature=818854f8eaad7630e592afe12531130ef838c32f8396cb1214a04f0c403ebe1b:1  Failed to load resource: the server responded with a status of 422 (Unprocessable Content)

// and if i clicked on it show

Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException
vendor/laravel/framework/src/Illuminate/Routing/AbstractRouteCollection.php:130
The GET method is not supported for route livewire-42321e45/upload-file. Supported methods: POST.

LARAVEL
13.3.0
PHP
8.5.4
UNHANDLED
CODE 0
405
GET
https://javen.com/livewire-42321e45/upload-file?expires=1782956273&signature=ceee62015849af40d80913638814c5afa156c6521945bd4c9aaf0554931c72b3

Exception trace
33 vendor frames

Illuminate\Foundation\Application->handleRequest()
public/index.php:20

15
16// Bootstrap Laravel and handle the request...
17/** @var Application $app */
18$app = require_once __DIR__.'/../bootstrap/app.php';
19
20$app->handleRequest(Request::capture());
21
  • project work 100% in local host but with apache however i my ngnix not working preview yet
0 likes
1 reply
krisi_gjika's avatar

the url you mention livewire-####/upload-file is provided by livewire ONLY for secure uploads, to get the file for preview you must not use this same url.

after upload the attribute where you store this image must have a temporaryUrl method, so you only need to do: <img src="{{ $photo->temporaryUrl() }}" class="">

Please or to participate in this conversation.