API connection error


Hello there, i have built a small API using adonisJS and deployed it on a my server, which works fine both locally and on the server.

I also built a frontend to consume the API using Laravel, this works well on my local machine, but once deployed on the server. It stops connecting to the API

find my config below

server: nginx
adonisVersion: 4.1.0
laravelVersion: 5.8
phpFPM: 7.1
O.S: ubuntu-16.04

Thanks for your help in advance.



Hello @iamtunde

A lot of information lacking from here :slightly_frowning_face:

But most likely the case: Laravel’s production (server) Adonis API URL is wrong?
You can set it in .env or in some config files where you have it set in your code.

Also when config is cached you have to reset Laravel config cache. You can do it with php artisan. I don’t remember exact command



hi @McSneaky

I’ve cross checked the API URL and cleared cache it’s still the same, no error logs on both ends.

you can try here

use a valid email and any password



Hi @iamtunde

Can you access API directly with browser?

Is your API on same machine and just on different port or is it on other address?

Maybe there is firewall on API server blocking access to it?

Or perhaps you can edit Laravel code in production, make some sort of test endpoint, that just returns API URL as string, so you can check, if it is what it is expected to be.



@McSneaky, thanks for your response I’ve eventually realised what the problem is.

It was actually an environment problem of the frontend, connecting to the API server on HTTPS via cURL, I had to put some security measures in place.

Thanks once again.