# Errorlog shows GET timeout; Accesslog shows POST

**URL:** <https://www.ruby-forum.com/t/errorlog-shows-get-timeout-accesslog-shows-post/244655>\
**Category:** NGINX\
**Created:** [May 21, 2016, 9:36pm UTC](https://www.ruby-forum.com/t/errorlog-shows-get-timeout-accesslog-shows-post/244655 "2016-05-21T21:36:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sadaf\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@Sadaf\_N](https://www.ruby-forum.com/u/Sadaf_N)\
**Post date:** [May 21, 2016, 9:36pm UTC](https://www.ruby-forum.com/t/errorlog-shows-get-timeout-accesslog-shows-post/244655/1 "2016-05-21T21:36:52Z")

</div>

Hello!

Background

We’ve implemented a lightweight APIGW on nginx 1.9.9 using openresty  
packages to customize the handling/proxying logic. We have dozens  
clients  
that are able to leverage this implementation just fine.

The Issue

We have one client that is experiencing some weird issues when trying to  
access our APIGW. This is only for certain requests coming from their  
app.  
We strongly believe it’s a malformed request from their side but we’re  
trying to help them find the issue. The behavior we see on our side is  
quite strange as well. The error.log will show a GET request that timed  
out. The access.log shows a POST request for the same request. Below  
are  
the two entries; the response time always seems to be around 5 seconds;  
but  
lowest timeout explicitly set in our configuration is 10 seconds.

Error log entry

2016/05/18 11:34:51 [info] 13516#0: \*304290 client prematurely closed  
connection, client: xx.xxx.xx.xxx, server: , request: “GET /hidden\_uri  
HTTP/1.1”, host: “[blahblahblah.com](http://blahblahblah.com)”

Access log entry

|LOCATION:GATEWAY|CN:NA|SSLPROTOCOL:TLSv1|SSLCIPHER:ECDHE-RSA-AES256-SHA|SERVICE:NA|VERSION:1|CLIENT:NA|BACKEND:|HTTPMETHOD:POST|ACCEPT:application/json;  
v=4|OPERATION:NA|RESPONSETIME:5005|STATUS:400|SEVERITY:NA|STATUSCODE:NA|STATUSMESSAGE:NA|CLIENTIPADDRESS:xx.xxx.xx.xxx|CLIENTMESSAGEID:NA|MESSAGEID:|REQUESTBODYSIZE:0|RESPONSEBODYSIZE:0

Configuration for access log

‘$timestamp|LOCATION:$location\_name|CN:$cn|SSLPROTOCOL:$ssl\_protocol|SSLCIPHER:$ssl\_cipher|SERVICE:$service\_name|VERSION:$version|CLIENT:$upstream\_api\_key|BACKEND:$route\_location|HTTPMETHOD:$upstream\_method|ACCEPT:$accept|OPERATION:$operation|RESPONSETIME:$request\_time\_ms|STATUS:$status|SEVERITY:$severity|STATUSCODE:$status\_code|STATUSMESSAGE:$status\_message|CLIENTIPADDRESS:$clientip|CLIENTMESSAGEID:$clientmessageid|MESSAGEID:$messageid|REQUESTBODYSIZE:$content\_length|RESPONSEBODYSIZE:$body\_bytes\_sent’;

Posted at Nginx Forum:

> **[Errorlog shows GET timeout; Accesslog shows POST](https://forum.nginx.org/read.php?2,267030,267030#msg-267030)**
>
> Hello! Background We've implemented a lightweight APIGW on nginx 1.9.9 using openresty packages to customize the handling/proxying logic. We have dozens clients that are able to leverage this implementation just fine. The Issue We have one

---

<div class="post-metadata">

**Author:** ![bclod](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f19dbf/32.png) [@bclod](https://www.ruby-forum.com/u/bclod)\
**Post date:** [May 22, 2016, 3:06pm UTC](https://www.ruby-forum.com/t/errorlog-shows-get-timeout-accesslog-shows-post/244655/2 "2016-05-22T15:06:00Z")

</div>

On Fri, May 20, 2016 at 03:45:15PM -0400, bclod wrote:

Hi there,

> We’ve implemented a lightweight APIGW on nginx 1.9.9 using openresty  
> packages to customize the handling/proxying logic. We have dozens clients  
> that are able to leverage this implementation just fine.

I suspect that the details of the request/response, or at least the  
details of what the request-data flow-response is supposed to be, will  
be useful in finding and fixing the problem.

> We have one client that is experiencing some weird issues when trying to  
> access our APIGW. This is only for certain requests coming from their app.  
> We strongly believe it’s a malformed request from their side but we’re  
> trying to help them find the issue.

Do you know what your side expects the request to be? (your API design.)

Can you see what request your side receives? (tcpdump/ssldump, or  
perhaps  
nginx-side extra logging.)

If they differ, that points at where the problem is.

> The behavior we see on our side is  
> quite strange as well. The error.log will show a GET request that timed  
> out.

The error log entry shows that nginx thinks that the requesting client  
closed the connection before nginx was ready to close the connection.

That might be “timed out”, or might be “error”.

> The access.log shows a POST request for the same request. Below are  
> the two entries; the response time always seems to be around 5 seconds; but  
> lowest timeout explicitly set in our configuration is 10 seconds.

The access log seems very customised to your site; and includes  
some variables that are not nginx-default. Perhaps they are  
openresty-default? (Google doesn’t make it look like they obviously  
are.)

You say “timeout explicitly set in our configuration”. If it was the  
client that closed the connection because its idea of a timeout passed,  
then your configuration is irrelevant unless it sets the client-side  
timeout.

> 

|LOCATION:GATEWAY|CN:NA|SSLPROTOCOL:TLSv1|SSLCIPHER:ECDHE-RSA-AES256-SHA|SERVICE:NA|VERSION:1|CLIENT:NA|BACKEND:|HTTPMETHOD:POST|ACCEPT:application/json;

HTTPMETHOD there is $upstream\_method, which is not (by default) what  
the client sent to nginx.

I think that there’s not enough information here to allow someone else  
discover the problem. If you can make a reproducible failure case,  
that will probably make it easier to discover.

Good luck with it,

## f

Francis D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![bclod](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f19dbf/32.png) [@bclod](https://www.ruby-forum.com/u/bclod)\
**Post date:** [May 23, 2016, 2:46pm UTC](https://www.ruby-forum.com/t/errorlog-shows-get-timeout-accesslog-shows-post/244655/3 "2016-05-23T14:46:39Z")

</div>

Francis,

You are totally right! I forgot that that we were using some crap logic  
for  
the variables; we are switching this to $request\_method (the actual  
built in  
variable). Your notes confirm to me what I was thinking all along: that  
the  
client is likely closing the connection after 5 seconds. We are doing a  
debug session today with tcpdump to get more details.

Thanks for setting me straight!

Posted at Nginx Forum:

> **[Re: Errorlog shows GET timeout; Accesslog shows POST](https://forum.nginx.org/read.php?2,267030,267057#msg-267057)**
>
> Hello! Background We've implemented a lightweight APIGW on nginx 1.9.9 using openresty packages to customize the handling/proxying logic. We have dozens clients that are able to leverage this implementation just fine. The Issue We have one
