wodby / nginx

Nginx docker container image
https://wodby.com/stacks
MIT License
72 stars 51 forks source link

nginx rule for Laravel livewire in Laravel template #96

Closed afraazali closed 1 month ago

afraazali commented 1 month ago

When using Laravel Livewire, there's a script that's added, which uses the route: /livewire.js. The current nginx configuration tries to serve this as a static asset, due to the NGINX_STATIC_EXT_REGEX variable.

The current workaround is to simply remove js from the NGINX_STATIC_EXT_REGEX variable. Another work around is to create your own preset.

Would it be possible to add the follow location directive to the laravel preset:

location = /livewire/livewire.js {
    expires off;
    try_files $uri $uri/ /index.php?$query_string;
}
csandanov commented 1 month ago

Added, could you please test once the built completed. If everything is ok I will release a tag

afraazali commented 1 month ago

Thank you @csandanov. I confirmed this is working for me. I appreciate the quick turnaround!