Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Copy link
Copy link
Closed
@darioriverat

Description

@darioriverat
Issue body actions

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.