Routes in web.php Not Working After Migrating to Acorn 4 – Looking for Insights

Hi everyone,

I couldn’t identify the root cause, but for some reason, routes defined in web.php stop working after migrating to Acorn 4.

Here’s a workaround you can use:

        add_action('template_redirect', function () {
            $acornRoutes = ['/user-type', '/debug-session'];
            foreach ($acornRoutes as $route) {
                if (strpos($_SERVER['REQUEST_URI'], $route) === 0) {

                    $kernel = app(\Illuminate\Contracts\Http\Kernel::class);
                    $response = $kernel->handle(
                        $request = \Illuminate\Http\Request::capture()
                    );
                    $response->send();
                    $kernel->terminate($request, $response);
                    exit;
                }
            }
        });

This snippet ensures the specified routes are handled correctly.

If anyone has an explanation for why this happens, I’d be glad to hear it!

1 Like