MethodNotAllowedHttpException path without CSRF

-1

I put a route in laravel which is called by a function in JS and I do not have control of it because it is external, this route is a post method since I need it to be that way but it generates a MethodNotAllowedHttpException as I do to exclude certain routes from this validation.

Note: I have already tried adding it in VerifyCsrfToken in its exception vector, modifying that class file VerifyCsrfToken extends Middleware to a new file called class VerifyCsrfToken extends BaseVerifier with all its dependencies and I have also disabled the validations in the Middleware but none of them it works

    
asked by Mhurtado 01.03.2018 в 01:21
source

1 answer

0

This type of implementations are usually common with payment gateways, I have done it many times, without any problem.

The error message is very specific:

  

the JS function is using a method (verb) not allowed

so you should check which is the method or verb that is using the JS function through Laravelo debug some other tool.

What I would do to detect this method is to use Request to determine what is coming:

$method = $request->method();

Log::info($method);

Afterwards it would simply be to adapt the route to what it is receiving, be it POST, GET, etc ...

EDIT: According to the information provided in a comment, I see that the URL used in the exception is a complete address:

protected $except = [
    'dominio.com/resexdev/public/autentificacion';
];

Although I consider that this has NOTHING to do with the error, it would be best to use the relative url simply, and the semicolon (;) after the URL is incorrect, since it is an array.

protected $except = [
    'autentificacion',
];
    
answered by 01.03.2018 в 01:50