Fabio Silva
Fabio Silva

Reputation: 31

Laravel: something is changing the method, what is it?

I have a simple blade form mith post method and csrf token:

<form name="login" action="{{ route('login.do') }}" method="post" autocomplete="off">
    @csrf
    <label>
        <span class="field icon-envelope">E-mail:</span>
        <input type="email" name="email" required/>
    </label>

    <label>
        <span class="field icon-unlock-alt">Password:</span>
        <input type="password" name="password_check"/>
    </label>

    <button class="gradient gradient-orange radius icon-sign-in" type="submit">Send</button>
</form>

and the route in routes/web.php:

Route::post('login', 'AuthController@login')->name('login.do');

when I submit the form, I get the error:

Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException

The GET method is not supported for this route. Supported methods: POST.

As you can see, the route and the form are ok, but something is messing it up and changing the method. It won't even get to the controller layer.

some infos:

-Laravel 8.12

-I have no customized middleware

-The htaccess and config/cors are default

-The route doesn't end with a slash nor is duplicated

-Whenever I do an alteration I clean the caches

-The APP_URL starts with http and SESSION_SECURE_COOKIE is set to false due to it

-The APP_ENV is production

What can it be? I've read it may be something in the server that's blocking the request and changing its method, so I'm not sure if the error is laravel or server related.

Upvotes: 3

Views: 89

Answers (1)

Md Atiqur Rahman
Md Atiqur Rahman

Reputation: 27

public function login(Request $request){
    
   dd($request->all());
    
}

Upvotes: -1

Related Questions