405 Method Not Allowed

I’m seeing occasional errors like the following in my PHP error log:log.DEBUG: 405 Method Not Allowed Type: Slim\Exception\HttpMethodNotAllowedException Code: 405 Message: Method not allowed. Must be one of: GET File: /usr/local/lsws/sites/mysite/httpdocs/vendor/slim/slim/Slim/Middleware/RoutingMiddleware.php Tips: To display error details in HTTP response set “displayErrorDetails” to true in the ErrorHandler constructor.I’m not sure what’s causing these errors, but it seems that a GET route is being called by a method other than GET. How can I track this down? This is a production site, so I can’t put it in debug mode, but I’d like for the error log to provide the exact route that’s causing this error.

When you are re-generating ALL the script files on localhost, and you see there are some updates for some packages that came from Composer Update, then you should re-upload ALL the script files to the production server.

Sometimes, there are some changes in some files in vendor folder, but you only re-upload only some files that not including the files from vendor folder. That’s why the closest approach is to re-upload ALL the generated script files to the production server. Always do that if you think there are no issue on localhost, but you have the issue on production server.If you are not sure, you may also compare all the generated script files in vendor subfolder between localhost and your production server by using tools such as WinMerge.Please note, always backup your script files in production server before re-uploading ALL the script files from localhost; just in case there are some problems, you have the chance to restore the previous version.

I sync all files on every build, so this is not an issue with Composer packages.

You better check your Custom Files (especially if you try to do HTTP POST to them), Route_Action and API_Action server event.bkonia wrote:

Tips: To display error details in HTTP response set “displayErrorDetails” to true in the ErrorHandler constructor.

The error message suggested ‘set “displayErrorDetails” to true’, you may manually change index.php as follows:change the line:$errorMiddleware = $app->addErrorMiddleware($displayErrorDetails, $logErrors, $logErrorDetails);to:$errorMiddleware = $app->addErrorMiddleware(true, $logErrors, $logErrorDetails); // Display error details as suggested by the error message