简体   繁体   English

从Chrome Android而不是台式机尝试时,Apache2,Uhuntu,PHP代码生成器不断获取404

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

Hi Good Coders of Satckoverflow, 嗨,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. 因此,从台式机Chrome或台式机上的任何其他浏览器调用我的网站时,它工作正常,而尾随apache2记录的是我发布的网址,仅作为路径。

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

However when I try from Android Chrome I see 但是,当我尝试使用Android Chrome浏览器时,

" http://xx.xxx.xx.xx/my_folder/index.php/Controller/function " other than that there is no visible difference in the logs. http://xx.xxx.xx.xx/my_folder/index.php/Controller/function ”不同之处在于日志中没有可见的差异。

Keep in mind it only fails for Post requests. 请记住,它仅对Post请求失败。

However from the Android Opera mini browser I do not get the same issue. 但是,从Android Opera mini浏览器不会出现相同的问题。 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. 现在,当我在Windows开发环境中使用xampp并让我的手机使用相同的LAN在Windows xampp上访问它时,我可以正常访问它,并且日志中没有显示主机ip,这似乎是问题的起因。 (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) (这是排除浏览器实现的原因,因为它是同一个Chrome浏览器,仅主机已从ubuntu服务器上的Apache2更改为Windows上的xampp)

I have observed proper etiquette in the controller conventions, ie "Mycontroller extends CI_Controller" and the file name "Mycontroller.php". 我在控制器约定中观察到适当的礼节,即“ Mycontroller extended CI_Controller”和文件名“ 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. 我在Opera Turbo选项和Web应用程序方面遇到了一些问题。 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. 因此,在转了一圈之后,我注意到在Wifi上我可以发布到实时网站而没有任何问题,而在电话数据包上则无法。 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. 记录日志显示,在wifi上我无法获取IP int请求,而在数据包上则无法获取IP,原因尚不清楚。

However the solution was to go to CI congig.php and change this line from 但是,解决方案是转到CI congig.php,并从

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

to

$config['uri_protocol'] = 'PATH_INFO'; $ 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? 我真的仍然想了解为什么我会收到不同的发帖请求,具体取决于我使用的是数据包还是Wifi?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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