【发布时间】:2016-05-14 09:21:05
【问题描述】:
我们创建了基于 PHP 的插件,该插件提供了一个 RESTful 界面,供我们正在开发的移动应用程序使用。该插件是自托管的,这意味着任何想要使用移动应用程序的人都必须在他们的服务器上安装这个 PHP 插件。我们的一位用户报告说,安装插件后他们无法登录。使用 Postman 练习登录请求中涉及的 API,我想出了以下内容:
请求
PUT http://<user's website>/index.php/wurrd/clientinterface/operator/login
{"username":"apple", "password":"dove", "clientid":"AABBB-CCCCC-DEFGHIJ", "deviceuuid":"aaa-uuu-isdi"}
回复
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head>
<title>501 Method Not Implemented</title>
</head>
<body>
<h1>Method Not Implemented</h1>
<p>GET to /chat/index.php/wurrd/clientinterface/operator/login not supported.
<br />
</p>
<p>Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body>
</html>
API 不会为 GET 公开该路由,因此当尝试通过 GET 到达那里时,错误消息是合适的。但是,问题在于请求是使用 PUT 发出的。
我不知道如何调查这个问题。服务器正在运行 Apache。 .htaccess 可能有问题吗?我认为可能是 mod_rewrite 问题,但我想这应该处理 URL 而不是 HTTP 方法。
另外,路由是使用 Symfony2 路由组件完成的。
任何帮助将不胜感激。
谢谢。
更新 1:
这是 Symfony 路由的配置:
wurrd_client_operator_login:
# The login request details are passed in as a JSON payload.
path: /wurrd/clientinterface/operator/login
defaults:
_controller: Wurrd\Mibew\Plugin\ClientInterface\Controller\OperatorController::loginAction
methods: [PUT]
【问题讨论】:
-
检查网络服务器日志文件
-
@CharlotteDunois,我会检查我们是否可以提取一些日志文件。