简体   繁体   中英

Apache2, Uhuntu, PHP codeigniter keep getting 404 when trying from Chrome Android but not Desktop

Hi Good Coders of Satckoverflow,

I have a very peculiar error I'm sure it's something small that i have overlooked.

So while calling my website from the desktop chrome or any other browser on desktop it works just fine and while tailing apache2 logs the url I POST to appears as just a path.

"/my_folder/index.php/Controller/function"

However when I try from Android Chrome I see

" http://xx.xxx.xx.xx/my_folder/index.php/Controller/function " other than that there is no visible difference in the logs.

Keep in mind it only fails for Post requests.

However from the Android Opera mini browser I do not get the same issue. Which would be tempting to believe it's a browser implementation thing which I have since ruled out.

Now when I use xampp on windows dev environment and make my phone use the same LAN to access it on my windows xampp I can access it fine and the logs don't display the host ip which seems to be the route cause of the issue. (this is what ruled out browser implementation since its the same chrome browser only the host has changed from Apache2 on ubuntu server to xampp on windows)

I have observed proper etiquette in the controller conventions, ie "Mycontroller extends CI_Controller" and the file name "Mycontroller.php". Which seems to be a common cause for these symptoms.

Kindly provide any feedback or ideas.

I have had some problems with the opera Turbo option and web applications. Make sure it's disabled. Maybe that will help?

So after going round in circles I noticed that on Wifi I could post to the live website without any problems and on phone data bundles I could not. Tailing the logs showed that on wifi I would not get the IP int the post request and on data bundles I would, the reason for this is still not clear.

However the solution was to go to CI congig.php and change this line from

$config['uri_protocol'] = 'AUTO';

to

$config['uri_protocol'] = 'PATH_INFO';

And it worked like a charm. I would really still like to understand why I received different post request depending on whether I was on data bundles or Wifi?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM