skip to Main Content

this is the URL defined to return after successful payment:

"returnURL" => 'https://wearlarimo.com/success/' . $this->order->id

and this is the route to get the Success page of Livewire Laravel 11:

Route::get('/success/{order:id}', Success::class)->name('success');

but I get the error:

Oops! An Error Occurred
The server returned a "405 Method Not Allowed".
Something is broken. Please let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for any inconvenience caused.

but, if I enter the URL and press enter that works fine!

Also this is middleware:

    ->withMiddleware(function (Middleware $middleware) {
        $middleware->web([CartMiddleware::class]);

        $middleware->alias([
            'role' => SpatiePermissionMiddlewareRoleMiddleware::class,
            'permission' => SpatiePermissionMiddlewarePermissionMiddleware::class,
            'role_or_permission' => SpatiePermissionMiddlewareRoleOrPermissionMiddleware::class,
        ]);
        $middleware->trustProxies(headers: Request::HEADER_X_FORWARDED_FOR |
            Request::HEADER_X_FORWARDED_HOST |
            Request::HEADER_X_FORWARDED_PORT |
            Request::HEADER_X_FORWARDED_PROTO |
            Request::HEADER_X_FORWARDED_AWS_ELB
        );

        $middleware->trustProxies('*');
    })

2

Answers


  1. Chosen as BEST ANSWER

    this worked:

    $middleware->validateCsrfTokens(except: ['success/*']);
    

  2. I already had this problem with laravel sanctium, it happens sometimes when you don’t pass through your middleware (for my example i wasn’t authenticated and tried to access to an auth route). I suggest you to put some logs in your middleware to make sure this doesn’t happen.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search