Laravel - API的CURL测试适用于localhost,但不适用于实时网站

时间:2014-11-27 21:42:22

标签: php curl laravel laravel-4 laravel-routing

我很难在生产服务器上访问我的Laravel API。开发服务器(localhost)工作正常。在我的本地主机上,我正在使用:

curl -X POST -d 
'{"email":"testuser@domain.com","password":"password"}'
http://localhost:8888/api/auth

哪个正确返回:

{"status":"true","request":"postAuth"}

路线:

Route::post('api/auth', 'APIController@authUser');

当我尝试在实际网站上访问此API时(使用https://),它会返回“whoops,找不到此页面”的完整错误页面:

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="robots" content="noindex,nofollow" />
        <style> etc...

我还通过Laravel Forge安装了SSL证书,所以如果我使用http://,它会返回:

<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.6.2</center>
</body>
</html>

为什么我可以在localhost上访问API而不在生产服务器上访问?任何帮助将非常感激。我想我已添加了所有代码,但如果您需要任何其他部分,请告诉我。

0 个答案:

没有答案