jira-importer opened a new issue, #903: URL: https://github.com/apache/httpcomponents-core/issues/903
**[Jesper Hammarbäck](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=jesper.hammarback)** opened **[HTTPCORE-401](https://issues.apache.org/jira/browse/HTTPCORE-401?redirect=false)** and commented The NHttpReverseProxy often times out, resulting in the response "Empty reply from server" even though I can see from the server logs that the response was submitted without any problems. This only happens when the responding server is on a different IP, i.e. it never fails if both proxy and the server is on the same machine. It looks like the proxy is listening to the wrong channel initially, as subsequent requests to the same route seem to have a higher chance of succeeding. I did the following: * svn co http://svn.apache.org/repos/asf/httpcomponents/httpcore/tags/4.4.1 * mvn clean install * Started a simple HTTP server on my "host2:12345" * Opened httpcore-nio\pom.xml in my IDE and started NHttpReverseProxy on my "host1" with parameters "http://host2:12345 8080" I executed curl: > $ curl -v http://host1:8080/my-ping > * STATE: INIT => CONNECT handle 0x600056480; line 1034 (connection #-5000) > * STATE: CONNECT => WAITCONNECT handle 0x600056480; line 1087 (connection `#0`) > * Connected to host1 (::1) port 8080 (`#0`) > * STATE: WAITCONNECT => DO handle 0x600056480; line 1233 (connection `#0`) > >> GET /my-ping HTTP/1.1 >> User-Agent: curl/7.38.0 >> Host: host1:8080 >> Accept: \*/\* > > * STATE: DO => DO_DONE handle 0x600056480; line 1319 (connection `#0`) > * STATE: DO_DONE => WAITPERFORM handle 0x600056480; line 1445 (connection `#0`) > * STATE: WAITPERFORM => PERFORM handle 0x600056480; line 1458 (connection `#0`) > * STATE: PERFORM => DONE handle 0x600056480; line 1628 (connection `#0`) > * Empty reply from server > * Connection `#0` to host host1 left intact > curl: (52) Empty reply from server The output from NHttpReverseProxy was: > [client->proxy] connection open 0:0:0:0:0:0:0:1:8080<->0:0:0:0:0:0:0:1:53826 > [client->proxy] 00000013 GET /my-ping HTTP/1.1 > [client->proxy] 00000013 request completed > [proxy->origin] connection open host1:53827<->host2:12345 > [proxy->origin] 00000013 GET /my-ping HTTP/1.1 > [client->proxy] connection closed 0.0.0.0:8080<->0:0:0:0:0:0:0:1:53826 > [proxy->origin] 00000013 request completed > [client<-proxy] 00000013 java.net.SocketTimeoutException > [proxy->origin] connection released host1:53827<->host2:12345 > [proxy->origin] [total kept alive: 0; total allocated: 0 of 100] > [proxy->origin] connection closed 0.0.0.0:53827<->host2:12345 I then executed the curl again and got following successful answer: > $ curl -v http://host1:8080/my-ping > * STATE: INIT => CONNECT handle 0x600056480; line 1034 (connection #-5000) > * STATE: CONNECT => WAITCONNECT handle 0x600056480; line 1087 (connection `#0`) > * Connected to host1 (::1) port 8080 (`#0`) > * STATE: WAITCONNECT => DO handle 0x600056480; line 1233 (connection `#0`) > >> GET /my-ping HTTP/1.1 >> User-Agent: curl/7.38.0 >> Host: host1:8080 >> Accept: \*/\* > > * STATE: DO => DO_DONE handle 0x600056480; line 1319 (connection `#0`) > * STATE: DO_DONE => WAITPERFORM handle 0x600056480; line 1445 (connection `#0`) > * STATE: WAITPERFORM => PERFORM handle 0x600056480; line 1458 (connection `#0`) > * HTTP 1.1 or later with persistent connection, pipelining supported > < HTTP/1.1 200 OK > < Date: Wed, 22 Apr 2015 14:41:02 GMT > * Server Test/1.1 is not blacklisted > < Server: Test/1.1 > < Content-Length: 31 > < Content-Type: application/json > < > * STATE: PERFORM => DONE handle 0x600056480; line 1628 (connection `#0`) > * Connection `#0` to host host1 left intact > {"timestamp": "1429713663916" } The output from the proxy server: > [client->proxy] connection open 0:0:0:0:0:0:0:1:8080<->0:0:0:0:0:0:0:1:53863 > [client->proxy] 00000014 GET /my-ping HTTP/1.1 > [client->proxy] 00000014 request completed > [proxy->origin] connection open host1:53864<->host2:12345 > [proxy->origin] 00000014 GET /my-ping HTTP/1.1 > [proxy->origin] 00000014 request completed > [proxy<-origin] 00000014 HTTP/1.1 200 OK > [client<-proxy] 00000014 response triggered > [client<-proxy] 00000014 HTTP/1.1 200 OK > [proxy->origin] connection kept alive host1:53864<->host2:12345 > [proxy<-origin] 00000014 31 bytes read > [proxy<-origin] 00000014 content fully read > [proxy<-origin] 00000014 response completed > [proxy->origin] connection released host1:53864<->host2:12345 > [proxy->origin] [total kept alive: 1; total allocated: 1 of 100] > [client<-proxy] 00000014 31 bytes written > [client<-proxy] 00000014 content fully written > [client<-proxy] 00000014 response completed > [client->proxy] connection kept alive 0:0:0:0:0:0:0:1:8080<->0:0:0:0:0:0:0:1:53863 > [client->proxy] connection closed 0.0.0.0:8080<->0:0:0:0:0:0:0:1:53863 A couple of seconds later the following is printed on the proxy console: > [proxy->origin] connection closed 0.0.0.0:53864<->host2:12345 After that the next request fails again. --- **Affects:** 4.4.1 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
