laravel / horizon

Dashboard and code-driven configuration for Laravel queues.
https://laravel.com/docs/horizon
MIT License
3.82k stars 636 forks source link

Custom URL breaks Vue routes #1449

Closed Okipa closed 1 month ago

Okipa commented 1 month ago

Horizon Version

5.24.3

Laravel Version

10.48.11

PHP Version

8.3.4

Redis Driver

PhpRedis

Redis Version

Irrelevant

Database Driver & Version

Irrelevant

Description

In an app that requires to work on a custom URL like https://domain.ext/base-path, Horizon Vue routes seems to be broken.

URL is defined with APP_URL in laravel and the use of the full path as root URL is done with the use of URL::forceRootUrl() in the AppServiceProvider.

When browing on Horizon page from https://domain.ext/base-path/horizon, an empty dashboard appears.
When clicking on any tab in the menu - let's take the Dashboard button - a redirection is made toward https://domain.ext/horizon/dashboard. The full URL is not taken in account.

The workload, stats and master resources are loaded from the https://domain.ext/horizon/api/workload, https://domain.ext/horizon/api/stats and https://domain.ext/horizon/api/master URLs, triggering a 404 error for each one of them.

Is there an existing way to make Horizon work in this case or is this something that is not existing yet?

Steps To Reproduce

Install a fresh Laravel Instance with Horizon, configured to be accessed from a prefixed URL like https://domain.ext/base-path.

Then, declare this custom URL in the .env APP_URL env variable.

In addition, declare URL::forceRootUrl('https://domain.ext/base-path') in the AppServiceProvider boot method.

Laravel will now use this URL as the base URL of all generated routes, but not for Horizon JS resources.

driesvints commented 1 month ago

We don't support apps running in a base path, sorry. Please always run your apps from the document root.