Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query on Content-Length response header #131

Closed
SudharsanN opened this issue Dec 8, 2019 · 2 comments
Closed

Query on Content-Length response header #131

SudharsanN opened this issue Dec 8, 2019 · 2 comments

Comments

@SudharsanN
Copy link

SudharsanN commented Dec 8, 2019

Hi,
We recently deployed a node app in production that talks to a API endpoint over https. Of late, we started noticing that the call to the API was failing with error as 'Parser Error : Duplicate Content-Length' and there were a minimum of 6-7 occurrences daily. Though the error message clearly indicates that the API is sending multiple content-length header in the response, we couldn't log these headers in the node app as the call were failing in the underlying node module before reaching our code.
Below are the open issues related to this in nodejs GitHub page.
nodejs/http-parser#435
nodejs/http-parser#460

In order to troubleshoot the issue better, we decided to introduce a nginx proxy between the node app and the API endpoint. We decided to use OpenResty as it allows us to use lua language and provides the ability to log the entire request and response including the headers in JSON format. Once we capture the error condition, we were planning to share it with the API team and press them for a fix.

To our surprise the error that used to occur at least 6-7 times a day stopped altogether. The log entries were all clean with only one content-length header and no failures in the app as such.
We are pretty sure that the API team didn't fix their code as they are waiting on us to capture the error scenario.

My queries here are as below.

  1. Does OpenResty or nginx or luajson that we are using is removing the duplicate content-length header if the values are same ?
  2. If the above is true, can you please point me to the docs. Also, is there a way for us to log the headers before it gets removed ?
  3. Are we inadvertently removing it as part of the lua script ? We are logging the entire request and response as JSON via this script. Please refer attachment.

The docker image we are using is "openresty/openresty:jessie" version is 1.13.6.1 and we are using "luajson" package. I have attached the docker file, nginx.conf and lua script as a zip file.
Archive.zip

Please clarify at the earliest as we are lost on what exactly is happening here.

Thanks,
Sudharsan N.

@neomantra
Copy link
Member

Hello, I can't help with your queries -- you might get more help on the OpenResty mailing list. But in terms of the OpenResty Docker images, was your OpenResty app working on one image tag and then not on another?

jessie images tags shouldn't have changed lately (they were archived a while ago). But if you move to more recent ones, make sure you use a full tag, like openresty/openresty:1.15.8.2-5-buster so you can control versions.

Changes and tags are shown here:
https://github.com/openresty/docker-openresty/blob/master/CHANGELOG.md

@SudharsanN
Copy link
Author

SudharsanN commented Dec 8, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants