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.
Asked
Active
Viewed 92 times
0

FazeL
- 916
- 2
- 13
- 30
1 Answers
2
These kinds of problem occurs when the server or loopJ closes your connection. it has several reasons:
- Firewall
- LoopJ's time out
- 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.

Pourya MandiSanam
- 400
- 3
- 10
-
How can I examine these issues ? – FazeL Mar 15 '16 at 13:57
-
Thank you since my server were slow and loopj's timeout was not enough. I increased it and The problem solved. – FazeL Mar 15 '16 at 14:11