From 9dd382722266127586ca76b2f2085b3c83f6415e Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Thu, 11 Jul 2024 12:43:29 -0700 Subject: [PATCH] Allow setting a prefix for Livewire's update and asset urls --- .env.example | 1 + app/Providers/LivewireServiceProvider.php | 32 +++++++++++++++++++++++ config/app.php | 3 ++- config/livewire.php | 17 ++++++++++++ 4 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 app/Providers/LivewireServiceProvider.php diff --git a/.env.example b/.env.example index c92dc22b71..5c0a0b8abc 100644 --- a/.env.example +++ b/.env.example @@ -183,6 +183,7 @@ REPORT_TIME_LIMIT=12000 REQUIRE_SAML=false API_THROTTLE_PER_MINUTE=120 CSV_ESCAPE_FORMULAS=true +LIVEWIRE_URL_PREFIX=null # -------------------------------------------- # OPTIONAL: HASHING diff --git a/app/Providers/LivewireServiceProvider.php b/app/Providers/LivewireServiceProvider.php new file mode 100644 index 0000000000..9fd0fd561f --- /dev/null +++ b/app/Providers/LivewireServiceProvider.php @@ -0,0 +1,32 @@ + 'tailwind', + + /* + |--------------------------------------------------------------------------- + | URL Prefix + |--------------------------------------------------------------------------- + | + | By default, Livewire sends network requests to {app.com}/livewire/update + | while javascript assets are served via {app.com}/livewire/livewire.js + | If you need to adjust the prefix of those urls you can do it below. + | + | Defining a prefix will result in the following url + | {app.com}/{prefix}/livewire/{update|livewire.js} + | Note: do not include the leading or trailing / + | + */ + + 'url_prefix' => env('LIVEWIRE_URL_PREFIX', null), ];