Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter 3.1.11 & PHP 7.3 - Random 404/405 Error
#1

(This post was last modified: 02-13-2021, 03:52 PM by usa13524.)

Hi All,

We are using RESTful Web Service in CodeIgniter Version 3.1.11 with PHP 7.3. We are using codeigniter-restserver (https://github.com/chriskacerguis/codeig...restserver) module and everything is working fine. All of sudden since last couple of days our lots of POST web service calls are failing and randomly returning "405 Method Not Allowed" errors. I have tried everything but still not able to narrow it down why all of sudden it starts, no code has been changed. We are running Apache on goDaddy Server. Not all the service are failing. For example out of 10 requests, first 4 success and rest 6 failed and returns 405 error.

********************************************************************************
* Total Number Of Requests: 10 (Round Robin, One by One)
* Total Number Of Success: 4 (200 OK) - First 4 Requests
* Total Number Of Failure: 6 (405 Method Not Allowed) - Last 6 Requests
********************************************************************************

I have added some tracing on the Rest controller and based on my finding seems the reason 405 error is returning for majority of the calls, because somehow those request methods are coming as GET and Web Service API Endpoint is only configured for POST. In the Apache Access Log all 10 requests are showing POST, but somehow majority of those requests are coming as GET to CodeIgniter REST Controller.

Web Service Endpoint: POST - https://www.abc.com/calculator/reserve

Here is some more information from CodeIgniter Controller Receiving the Request from Apache Web Server: 

2021-02-13 22:40:29 --> HTTP Request Method: post, URI: /calculator/reserve, ARGV[0]:/calculator/reserve
2021-02-13 22:40:30 --> HTTP Request Method: post, URI: /calculator/reserve, ARGV[0]:/calculator/reserve
2021-02-13 22:40:31 --> HTTP Request Method: post, URI: /calculator/reserve, ARGV[0]:/calculator/reserve
2021-02-13 22:40:32 --> HTTP Request Method: post, URI: /calculator/reserve, ARGV[0]:/calculator/reserve
2021-02-13 22:40:32 --> HTTP Request Method: get, URI: /calculator/reserve, ARGV[0]:/403.shtml
2021-02-13 22:40:33 --> HTTP Request Method: get, URI: /calculator/reserve, ARGV[0]:/403.shtml
2021-02-13 22:40:34 --> HTTP Request Method: get, URI: /calculator/reserve, ARGV[0]:/403.shtml
2021-02-13 22:40:35 --> HTTP Request Method: get, URI: /calculator/reserve, ARGV[0]:/403.shtml
2021-02-13 22:40:36 --> HTTP Request Method: get, URI: /calculator/reserve, ARGV[0]:/403.shtml
2021-02-13 22:40:37 --> HTTP Request Method: get, URI: /calculator/reserve, ARGV[0]:/403.shtml

Somehow last 6 calls method changed from POST to GET and also $_SERVER(argv[0]) value is change from my endpoint URI to 403.shtml.

Thanks,
SauGo
Reply




Theme © iAndrew 2016 - Forum software by © MyBB