Support the ongoing development of Laravel.io →
posted 10 years ago
Requests
Last updated 2 years ago.
0

I think this is when a request is made with a request method not supported; as example, using GET on a POST only route.

You could try setting up something like this, to see if you get more info, which should put something in the app\storage\laravel.log

// Exception: MethodNotAllowedHttpException
App::error(function(MethodNotAllowedHttpException $exception) {

    Log::warning('MethodNotAllowedHttpException', array('context' => $exception->getMessage()));

    return Response::view('errors.show', array('code' => 'http_error_404'), 404);
});
Last updated 2 years ago.
0

Thanks, i will try this, it seems to be very helpful !

Last updated 2 years ago.
0

Unfortunately, MethodNotAllowedHttpException does not supply any information about the route or the method requested, and the exception message is null. Would be nice if it give more information by default.

TerrePorter said:

I think this is when a request is made with a request method not supported; as example, using GET on a POST only route.

You could try setting up something like this, to see if you get more info, which should put something in the app\storage\laravel.log

// Exception: MethodNotAllowedHttpException
App::error(function(MethodNotAllowedHttpException $exception) {

   Log::warning('MethodNotAllowedHttpException', array('context' => $exception->getMessage()));

   return Response::view('errors.show', array('code' => 'http_error_404'), 404);
});
Last updated 2 years ago.
0

TerrePorter said:

I think this is when a request is made with a request method not supported; as example, using GET on a POST only route.

You could try setting up something like this, to see if you get more info, which should put something in the app\storage\laravel.log

// Exception: MethodNotAllowedHttpException
App::error(function(MethodNotAllowedHttpException $exception) {

   Log::warning('MethodNotAllowedHttpException', array('context' => $exception->getMessage()));

   return Response::view('errors.show', array('code' => 'http_error_404'), 404);
});

Where should that code be included?

0

galioy said:

TerrePorter said:

I think this is when a request is made with a request method not supported; as example, using GET on a POST only route.

You could try setting up something like this, to see if you get more info, which should put something in the app\storage\laravel.log

// Exception: MethodNotAllowedHttpException
App::error(function(MethodNotAllowedHttpException $exception) {

   Log::warning('MethodNotAllowedHttpException', array('context' => $exception->getMessage()));

   return Response::view('errors.show', array('code' => 'http_error_404'), 404);
});

Where should that code be included?

app/start/global.php I guess ..

0

Just in case anyone else runs across this... I had the same problem and would get random 'MethodNotAllowedHttpException' errors with my application (Laravel 4.2) and was unable to find what page(s)/method(s) were causing the problem.

It finally dawned on me to check the Apache access_log file and match up the time. When I did this I found a web spider that was checking various pages with POST where I only had routes for GETs, so I then simply added some logic to my routes to handle that.

Hope that helps!

0

Sign in to participate in this thread!

Eventy

Your banner here too?

soclosed soclosed Joined 5 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.