0

In the middleware for a Laravel 10 app I have CAS authentication. When I call cas()->checkAuthentication() there is a chance that the call will go to the campus authentication server and be returned back later. The issue is that when there is a large form being filled out the cas call will often decide to check then and lose all the form data the user filled out. They will return the user to the same page, but as GET with no data.

Every time I get a POST call I save off the post data into the session before checking authentication and I can merge the post data back into the request. My question is, how can I change the request to follow the POST path instead of the GET path from the middleware?

2
  • If I understand your question correctly, your middleware is returning back to your form as part of an authentication process and you want to preserve form data. Instead of trying to play with GET and POST requests, I would look into Laravel's built-in session "flashing" and the old helper method. laravel.com/docs/11.x/requests#old-input
    – sheng
    Commented Jul 8 at 19:11
  • GET/POST/ANY is a routing task, go on routes/web.php find your post and replace it with get ( and remember to execute "php artisan optimize" after any routes change)
    – emilianoc
    Commented Jul 9 at 12:43

0

Browse other questions tagged or ask your own question.