I am encountering a strange behavior where AWS Classic ELB is sending an indeterministic 504 response to the client instantly. The backend server (running on a K8S cluster) never receives a request. The ELB timeout can be ignored for consideration. The client gets the response within few milliseconds.
This behavior is seen when using Apache Commons HTTP Client or Java's native HttpConnection
. If I use the Unirest Java library, this no longer happens. Also, when Python's native requests library is used, it does not experience this problem.
Does anyone have some idea why this could be happening specifically when using different HTTP clients? HTTP 5XX is supposed to be server-side issue. I tried increasing client side connection and socket timeouts, but there is no effect at all. I'm using same headers across all the requests.