0

I have to use an restful API for my app in android, In this API we have to reverse proxy our app requests through our server( I use nginx proxy_pass for that), since the API only answers to one registered IP.
When I use curl to send a request through reverse proxy of nginx it works swell.
But when my Android app sends a request to it using loopj.asynchttp, onSuccessful fires but request status is 0, and body of answer is null, I'm totally confused. It returns no data so I could find out what is wrong with it. In logs of nginx requests from the mobile appears, so the request certainly reaches to my server, but the answer returned is problematic.

FazeL
  • 916
  • 2
  • 13
  • 30

1 Answers1

2

These kinds of problem occurs when the server or loopJ closes your connection. it has several reasons:

  1. Firewall
  2. LoopJ's time out
  3. enginx's time out

for first reason, it depends on your firewall, but it's so easy to configure it.

for loopJ's time out, you can use setTimeout function like following code:

AsyncHttpClient client = new AsyncHttpClient();
client.setTimeout(//connection time you need as an integer);

you can use following link to set your nginx time out configuration: click here!

I hope these tips help you.