简体   繁体   English

Codeigniter Rest Server拒绝一个请求

[英]Codeigniter Rest Server denies just one request

TL;DR TL; DR

I get a 404 (Not Found) error on calling an API method ( api/auth/authenticated ~GET). 我在调用API方法( api/auth/authenticated 404 (Not Found)收到404 (Not Found)错误。 I only get this on my live-server, not on local and not on any other methods. 我只能在我的实时服务器上获取此信息,而不能在本地或其他任何方法上获取。

The Problem 问题

I use Codeigniter with a Rest-Server library. 我将Codeigniter与Rest-Server库一起使用。 I have a simple method api/auth/authenticated (GET) that returns true if the user is logged in and false if not. 我有一个简单的方法api/auth/authenticated (GET),如果用户已登录,则返回true,否则返回false。 On the live-server this method gives me a 404 (Not Found) error. 在实时服务器上,此方法给我一个404 (Not Found)错误。 Other calls to the same api class work, for example api/auth/login (POST) works and api/auth/logout (GET) works as well. 对相同api类的其他调用也可以工作,例如api/auth/login (POST)可以工作,并且api/auth/logout (GET)也可以。

so how is this possible? 那怎么可能呢?

I have tried to delete the .htaccess file, but that didn't work. 我试图删除.htaccess文件,但这没有用。 It can't be a typo since it works locally. 由于它可以在本地运行,因此不能打错字。 Maybe some setting in Apache? 也许在Apache中有一些设置? But then why do the other methods work just fine? 但是,为什么其他方法也能正常工作呢?

I would be grateful for any ideas and hints. 如有任何想法和暗示,我将不胜感激。

my app 我的应用

my server env 我的服务器环境

  • digital ocean droplet 数字海洋飞沫
  • Ubuntu 14.04 Ubuntu 14.04
  • PHP 5.6.15 PHP 5.6.15
  • Apache 2.4.7 阿帕奇2.4.7

The worst problems are always the most stupid ones ... 最糟糕的问题总是最愚蠢的问题...

There should be a list on my desk. 我的桌子上应该有一张清单。

1. Check for typos (very important but was not the problem here) 1.检查拼写错误 (非常重要,但这不是问题所在)

Now if we are working on Windows or OSX and everything works fine and then some parts just don't work on Linux this one is very important: 现在,如果我们在Windows或OSX上工作,并且一切正常,然后某些部分在Linux上不工作,那么这一点非常重要:

2. Check filenames for case-sensitivity problems (also check the GIT config) 2.检查文件名是否区分大小写(也请检查GIT配置)

The Problem was still a bit harder to find. 问题仍然很难找到。 I use Git to push my live-deploy branch to my remote repository, which is then picked up by Deploybot and uploaded to my server. 我使用Git将live-deploy分支推送到远程存储库,然后由Deploybot将该远程存储库拾取并上传到我的服务器。 Git doesn't care about case sensitivity on default and files will stay like they were first added forever. Git并不关心默认大小写,文件会像最初被永久添加一样保持不变。 Thanks to this post i could just type one command to change it. 由于这篇文章,我可以键入一个命令来更改它。

git config core.ignorecase false

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

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