8000 Health endpoint is stripped out when defining routes with "using" keywork · Issue #55739 · laravel/framework · GitHub
[go: up one dir, main page]

Skip to content

Health endpoint is stripped out when defining routes with "using" keywork #55739

@darioriverat

Description

@darioriverat

Laravel Version

12.x

PHP Version

8.4

Database Driver & Version

No response

Description

Laravel comes with a built-in health check endpoint on /up, which is defined in the bootstrap/app.php file as an argument of the withRouting method. In specific circumstances, this endpoint is stripped out, in particular, when routes are defined utilizing the "using" parameter as an alternative to "web".

Current Behaviour

When running php artisan route:list in a fresh Laravel app, you get something similar to the following

GET|HEAD       / ......................................
GET|HEAD       storage/{path} ........... storage.local
GET|HEAD       up .....................................

When defining routes with the "using" parameter, the health check endpoint is removed from the routes, as we can observe by executing the route list again.

GET|HEAD       / ......................................
GET|HEAD       storage/{path} ........... storage.local

Expected Behaviour

The health check endpoint is perverse regardless of the way routes are defined, either utilizing web or using as an argument for withRouting.

Steps To Reproduce

  1. Create a fresh Laravel installation (e.g., laravel new my-app).
  2. Open the bootstrap/app.php file.
  3. Locate the default Application::configure(...)->withRouting(...) block:
return Application::configure(basePath: dirname(__DIR__))
    ->withRouting(
        web: __DIR__.'/../routes/web.php',
        commands: __DIR__.'/../routes/console.php',
        health: '/up',
    )
    ->withMiddleware(...)
    ->withExceptions(...)
    ->create();
  1. Run php artisan route:list and confirm the presence of the /up health check route.
  2. Modify the withRouting configuration by replacing the web file with an inline route using the using parameter:
->withRouting(
    using: function (Application $app) {
        Route::get('/', function () {
            return view('welcome');
        });
    },
    // web: __DIR__.'/../routes/web.php', <-- remove or comment out
    commands: __DIR__.'/../routes/console.php',
    health: '/up',
)
  1. Run php artisan route:list again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0