4

I am struggling to access my Laravel API on the production server. The development server (localhost) works fine. On my localhost, I am using:

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

Which correctly returns:

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

Route:

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

When I try to access this API on the actual website (using https://), it returns the full error page of 'whoops, this page cannot be found':

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

I have an SSL certificate also installed through Laravel Forge, so if I use http://, it returns:

<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>

Why can I access the API on localhost but not on the production server? Any help would be hugely appreciated. I think I've added all the code, but if you require any other parts, please let me know.

  • Is your local server running on a Windows machine? Could be a case sensitivity issue. The other option is turn on 'debug' on the production server briefly, and see exactly what the error stack shows where the problem is (then turn debug off). – Laurence Nov 28 '14 at 02:02
  • @TheShiftExchange - My local server is on OS X Yosemite (MAMP), my production server is run through Laravel Forge on Digital Ocean. –  Nov 28 '14 at 12:00
  • @DanHulton, sorry about the delayed reply. It turned out to be an SSL certificate error, where the Intermediate certificate wasn't installed. So, for example, it would work on certain browsers, but no others. It was a very odd issue but reissuing my SSL certificate seemed to have resolved it. –  Apr 19 '15 at 19:39
  • 1
    Please write an own answer for your question, so we can see this as resolved. Thanks. – opHASnoNAME Jul 11 '15 at 04:41

0 Answers0