Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Health route not registering when using routing customization #50816

Closed
miagg opened this issue Mar 28, 2024 · 3 comments
Closed

Health route not registering when using routing customization #50816

miagg opened this issue Mar 28, 2024 · 3 comments

Comments

@miagg
Copy link

miagg commented Mar 28, 2024

Laravel Version

11.1

PHP Version

8.3.3

Database Driver & Version

No response

Description

Laravel documentation states that you can have full control of routing registration using using parameter like this:

return Application::configure(basePath: dirname(__DIR__))
    ->withProviders()
    ->withRouting(
        using: function () {
            Route::middleware('web')
                ->group(function (Router $router) {
                    $router->impersonate();
                });

            Route::middleware('web')
                ->domain(config('filament.panels.partners.domain'))
                ->group(base_path('routes/partners.php'));

            // More Registrations here...
        },
        // channels: __DIR__.'/../routes/channels.php',
        commands: __DIR__.'/../routes/console.php',
        health: '/up',
    )

However the health route /up is not registering using this method. How can we manually register the route without publishing the view?

Steps To Reproduce

As explained above

@crynobone
Copy link
Member

I believe you should use the following instead:

return Application::configure(basePath: dirname(__DIR__))
    ->withProviders()
    ->withRouting(
-       using: function () {
+       then: function () {
            Route::middleware('web')
                ->group(function (Router $router) {
                    $router->impersonate();
                });

            Route::middleware('web')
                ->domain(config('filament.panels.partners.domain'))
                ->group(base_path('routes/partners.php'));

            // More Registrations here...
        },
        // channels: __DIR__.'/../routes/channels.php',
        commands: __DIR__.'/../routes/console.php',
        health: '/up',
    )

@laserhybiz
Copy link

The documentation states that using the using parameter disables all http routes:

When this argument is passed, no HTTP routes will be registered by the framework and you are responsible for manually registering all routes

@miagg
Copy link
Author

miagg commented Mar 29, 2024

Thanks. I've switched to then and it is now working.

@miagg miagg closed this as completed Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants