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