You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue #115 described problems when laravel had been installed to a subfolder. This has been fixed in 0.9.16. But there's still another problem with subfolders if you are using a path prefix which seems not to be fixed the change.
Background: Laravel path prefix
Take for example you have a laravel application at http://example.com/monitoringapp. If you use a webserver like caddy you can point the domain's path prefix monitoringapp to a laravel installation in a specific folder (e.g. /var/www/laravel-monitoring). Everything works correct when you include the path prefix in your .env (APP_URL=http://example.com/monitoringapp):
Routes are registered with /health/check because the /monitoringapp prefix must not be used when registering routes! (laravel will "ignore" the /monitoringapp when routing)
The routes are correctly accessible, they resolve to the correct controller.
No problem at this point :)
Problem
The code is using the routes.list[*].uri route path directly for axios to load the information. But this will point to /health/* and not /monitoringapp/health/*. The routes.prefix value can not be changed as described because the route has to be registered without the /monitoringappprefix. So the javascript code can not load the information.
Solution
Use laravel's url helper to generate absolute urls for axios, because it does now how to create the correct one:
route(config('health.routes.list[0].name')) => http://example.com/monitoringapp/health/panelCORRECT
Using the url-helper to generate the url for axios may probably solve many more problems with "esoteric" configurations how urls are mapped within laravel because it's relying on the same logic every url is routed within laravel.
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
Issue #115 described problems when laravel had been installed to a subfolder. This has been fixed in 0.9.16. But there's still another problem with subfolders if you are using a path prefix which seems not to be fixed the change.
Background: Laravel path prefix
Take for example you have a laravel application at
http://example.com/monitoringapp
. If you use a webserver like caddy you can point the domain's path prefixmonitoringapp
to a laravel installation in a specific folder (e.g./var/www/laravel-monitoring
). Everything works correct when you include the path prefix in your.env
(APP_URL=http://example.com/monitoringapp
):/health/check
because the/monitoringapp
prefix must not be used when registering routes! (laravel will "ignore" the/monitoringapp
when routing)Problem
The code is using the
routes.list[*].uri
route path directly for axios to load the information. But this will point to/health/*
and not/monitoringapp/health/*
. Theroutes.prefix
value can not be changed as described because the route has to be registered without the/monitoringapp
prefix. So the javascript code can not load the information.Solution
Use laravel's url helper to generate absolute urls for axios, because it does now how to create the correct one:
config('health.routes.list[0].uri')
=>/health/panel
WRONGroute(config('health.routes.list[0].name'))
=>http://example.com/monitoringapp/health/panel
CORRECTUsing the url-helper to generate the url for axios may probably solve many more problems with "esoteric" configurations how urls are mapped within laravel because it's relying on the same logic every url is routed within laravel.
The text was updated successfully, but these errors were encountered: