2016-02-04 96 views
1

我們創建了基於PHP的插件,該插件提供了我們正在使用的移動應用程序使用的RESTful界面。該插件是自主託管的,這意味着任何想要使用移動應用程序的人都必須在服務器上安裝此PHP插件。我們的一位用戶報告說,安裝插件後,他們無法登錄。使用郵差行使參與登錄請求中的API,我想出了以下內容:爲什麼我的PUT HTTP請求會轉換爲GET

REQUEST

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] 
+0

檢查Web服務器日誌文件 –

+0

@CharlotteDunois,我會檢查,如果我們能拉一些日誌文件。 –

回答

相關問題