On 13 Dec 2013, at 05:01, Esteban A. Maringolo <emaringolo@gmail.com> wrote:
Answering myself again (I knowâ¦).
Thanks for posting all this, it is useful.
There is some issue in how the Basic Authentication is handled in certain Android devices [1], which by chance (fortunately) is the same I use to develop with, so I had to change the way the header was set in the request, which basically I setup manually [2]
So, only good news. The server is up and running. In fact it is the second server, I created a second Droplet at Digital Ocean because the first had Ubuntu 12.04 LTS and I wanted a newer release to have the newer version of nignx as well. So Ubuntu 13.10 32bit it was.
The second time everything went smoother and faster. I'm thinking about setting up a Docker [3] container for Pharo, and then use it in Digital Ocean as well [4].
Is docker not 64-bit ? I am not sure running a 32-bit Pharo VM inside it will be easy, but maybe it is.
It was a long day, but worth it.
Best regards,
Esteban A. Maringolo
[1] https://github.com/loopj/android-async-http/issues/262 [2] http://stackoverflow.com/a/20558752/644918 [3] http://www.docker.io (anybody using it?) [4] https://www.digitalocean.com/community/articles/how-to-use-the-digitalocean-...
2013/12/12 Esteban A. Maringolo <emaringolo@gmail.com>:
Good news, bad news. :)
I decided to test using another great tool bundled with Pharo itself: ZnClient.
"Going through nginx" ZnClient new url: 'http://myserver.com/app-api/v1/auth/login'; setBasicAuthenticationUsername: '24603458' password: '1234'; logToTranscript; post; response.
And... as expected... it works!
The same if connect directly to Zinc (:8080).
So there is something wrong in the rest of the tools around... or I really don't know.
But the HTTP client library we're using at the Android (Java) side is one of the most used (http://loopj.com/android-async-http/), but also fails with org.apache.http client. So... it's not a matter of client.
I just need to understand the reason for the "Closed Connection".
Esteban A. Maringolo
2013/12/12 Esteban A. Maringolo <emaringolo@gmail.com>:
I'm having issues with a connection coming from an Android app connecting both trough an nginx proxy, but also using some REST testing tools:
nginx error log: 2013/12/12 23:23:17 [error] 701#0: *49 upstream prematurely closed connection while reading response header from upstream, client: XX.XX.XX.XX, server: app01.mydomain.com, request: "POST /app-api/v1/auth/login HTTP/1.1", upstream: "http://127.0.0.1:8080/app-api/v1/auth/login", host: "app01.mydomain.com:80" (END)
ZnZincSeasideAdapter log: 2013-12-12 23:23:17 897330 D Executing request/response loop 2013-12-12 23:23:17 897330 I Read a ZnRequest(POST /app-api/v1/auth/login) 2013-12-12 23:23:17 897330 T POST /app-api/v1/auth/login 200 114B 42ms 2013-12-12 23:23:17 897330 D ConnectionClosed: Cannot write data while writing response 2013-12-12 23:23:17 897330 D Closing stream
I'm using Basic HTTP Auth in each request.
But what's weird is that with curl it works perfectly fine.
Again, I think this is not strictly Zinc related, but it doesn't work connecting directly to the Zinc server either:
2013-12-13 00:17:02 939035 D Executing request/response loop 2013-12-13 00:17:02 939035 I Read a ZnRequest(POST /app-api/v1/auth/login) 2013-12-13 00:17:02 939035 T POST /app-api/v1/auth/login 200 114B 12ms 2013-12-13 00:17:02 939035 D ConnectionClosed: Cannot write data while writing response 2013-12-13 00:17:02 939035 D Closing stream
I don't know if this has to do with the wireless provider doing some proxying behind the wall (which they do), but given the fact that if I try using some REST testing tools from my computer and they also fail, I think it has to do with something else.
At nginx I'm forwarding the Authorization header to the Zinc Server:
proxy_set_header Authorization $http_authorization; proxy_pass_header Authorization;
Is there a way I can log the complete request headers at the Zinc side, and if possible also at nginx?
Regards,
Esteban A. Maringolo