dubstep
September 24, 2011, 1:44pm
1
Hello,
I’m using Nginx as a front end to my node.js application, nginx proxying
https request to my app.
When the browser gets the response back, instead of pure json
({“error”:“query error”,“message”:“Parameter(s) missing:
user,password”}), I
receive something like:
47
{“error”:“query error”,“message”:“Parameter(s) missing: user,password”}
0
I use ‘more_clear_headers’ module but do not have any luck.
This is the config I use:
server {
listen 443;
server_name my.server.com ;
ssl on;
ssl_certificate certificate.pem;
ssl_certificate_key privatekey.pem;
keepalive_timeout 70;
location / {
more_clear_headers 'Content-Length'; # Does not work as I would
expect
proxy_pass https://localhost:8443 ;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_buffering off;
proxy_buffers 8 8k;
}
}
Would you have any idea ?
Thanks a lot for your help,
Luc_J
September 24, 2011, 1:50pm
2
How are you testing it?
That looks like results I saw using telnet but those numbers do not
appear with a http client such as curl
On 24 Sep 2011, at 12:43, “Luc J.”
<[email protected] mailto:[email protected] > wrote:
Hello,
I’m using Nginx as a front end to my node.js application, nginx proxying
https request to my app.
When the browser gets the response back, instead of pure json
({“error”:“query error”,“message”:“Parameter(s) missing:
user,password”}), I receive something like:
47
{“error”:“query error”,“message”:“Parameter(s) missing: user,password”}
0
I use ‘more_clear_headers’ module but do not have any luck.
This is the config I use:
server {
listen 443;
server_name http://my.server.com
my.server.com http://my.server.com ;
ssl on;
ssl_certificate certificate.pem;
ssl_certificate_key privatekey.pem;
keepalive_timeout 70;
location / {
more_clear_headers 'Content-Length'; # Does not work as I would
expect
proxy_pass https://localhost:8443 https://localhost:8443 ;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_buffering off;
proxy_buffers 8 8k;
}
}
Would you have any idea ?
Thanks a lot for your help,
–
Luc
Luc_J
September 24, 2011, 2:05pm
3
Hello!
On Sat, Sep 24, 2011 at 01:43:12PM +0200, Luc J. wrote:
0
This is chunked encoding, likely sent by your backend in violation
of HTTP specification.
Right now there are two options available:
Fix your backend.
Upgrade to nginx 1.1.4, it has code needed to talk to such
broken backends.
Maxim D.
Luc_J
September 24, 2011, 2:59pm
4
Hello,
thanks for your answers.
Maxim, what would you recommend to fix the backend ? I do not really see
where could be the violation in fact.
–
Luc
Le Sep 24, 2011 14:05, Maxim D. [email protected] a crit :
Luc_J
September 24, 2011, 3:07pm
5
Hello,
I’m testing it from a browser and with curl as well and I got the same.
When I bypass nginx the response is correct. When I request from nginx,
the lenght is added at the beginning and 0 at the end of the json I
would expect.
–
Luc
Le Sep 24, 2011 13:49, Richard K. [email protected] a
crit :
Luc_J
September 24, 2011, 4:55pm
6
Hello!
On Sat, Sep 24, 2011 at 02:58:59PM +0200, Luc J. wrote:
Hello,
thanks for your answers.
Maxim, what would you recommend to fix the backend ? I do not really see where
could be the violation in fact.
Backend MUST NOT (as per RFC 2616) return chunked to HTTP/1.0
clients, while nginx uses HTTP/1.0 to talk to backends.
See RFC 2616, “3.6 Transfer Codings”
… A server MUST NOT send transfer-codings to an HTTP/1.0
client.
Maxim D.
Luc_J
September 24, 2011, 7:24pm
7
Does it mean something (like a parameter or something) needs to be
modified on my node.js application ? Do I need to send additionnal stuff
? I did not really get the “chunked” part.
–
Luc
Le Sep 24, 2011 16:54, Maxim D. [email protected] a crit :
Luc_J
September 25, 2011, 6:07pm
8
Thanks, I corrected this on back-end side (adding a content-length).
Luc
2011/9/24 Luc J. [email protected]
Luc_J
September 26, 2011, 10:16am
9
Luc J. wrote in post #1023663:
Thanks, I corrected this on back-end side (adding a content-length).
Luc
2011/9/24 Luc J. [email protected]
Hi Maxim,
We are facing issues with certain phones which post data with chunked
headers and no content length. These clients get error as 411.
i have tried this w/ apache it works.
Have we fixed this in any of current stable release we have any patch
for it to work.
Issue is similar to the one discussed in this link:
http://www.ruby-forum.com/topic/162976
Regards,
Sandesh K