'Can't run in subfolder Laravel Horizon

I am running my Laravel project in subfolder under domain. So far everything is normal. I add job queues by installing Horizon, but horizon works directly on domain, not in subfolder.

my project: example.com/new

Horizon: example.com/new/horizon

when i click it, horizon comes as example.com/horizon and paths like horizon/api/stats , horizon/api/masters, horizon/api/workload fall into 404 error.

When I look at the console, I get errors like GET example.com/horizon/api/stats 404 (Not Found)

Uncaught (in promise) Error: Request failed with status code 404
    at t.exports (app.js?id=9db6ba6424a3d1048c194c9c1e4429fe:2:5360)
    at t.exports (app.js?id=9db6ba6424a3d1048c194c9c1e4429fe:2:7772)
    at XMLHttpRequest.v (app.js?id=9db6ba6424a3d1048c194c9c1e4429fe:2:712)

In the config/horizon.php file;

'path' => 'horizon', i get an error when I change the path to 'path' => 'new/horizon',

Laravel version 8.x and Centos7 installed. How can i run Horizon in subfolder?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source