I’ve written a very simple script which acts as a specific proxy for XML
feeds, reading from a source URL and passing the content straight
through. It’s trivial and it’s working fine when run as a standalone
HTTP server (via node.js).
However when I put nginx in front of it I get what appear to be the
chunk hex markers in the output - which obviously renders the XML
invalid. Here is an example of the output, note the “f32” at line 1, and
the repeated “1000” on lines 53 & 85, the
“58a” on lines 125 & 137 and so on.
I’ve confirmed that the chunks themselves don’t contain the spurious
data (by dumping them to a file and checking with dhex), and apart from
the expected Server: change the HTTP headers are the same with and
without nginx:
However when I put nginx in front of it I get what appear to be the
chunk hex markers in the output - which obviously renders the XML
invalid. Here is an example of the output, note the “f32” at line 1, and
the repeated “1000” on lines 53 & 85, the
“58a” on lines 125 & 137 and so on.
There is an experimental patch that allows Nginx to speak HTTP 1.1 to
backends (including chunked responses):
I’m at a loss how to proceed and I’m hoping someone on the list
recognises the problem.
According to RFC2616, “A server MUST NOT send transfer-codings
to an HTTP/1.0 client.” That is, correct solution is to fix your
script - it must not return chunked data to nginx (as nginx uses
HTTP/1.0 in requests to backends).
Alternatively, you may upgrade to 1.1.x which has support for
HTTP/1.1 to backends and is able to recognize and remove chunked
encoding in such situations.
According to RFC2616, “A server MUST NOT send transfer-codings
to an HTTP/1.0 client.” That is, correct solution is to fix your
script - it must not return chunked data to nginx (as nginx uses
HTTP/1.0 in requests to backends).
Alternatively, you may upgrade to 1.1.x which has support for
HTTP/1.1 to backends and is able to recognize and remove chunked
encoding in such situations.
Hi Maxim - thanks for clarifying this for me. I’ve tried the previously
mentioned patch without success, I’ll see if I can upgrade to 1.1.x but
there are a lot of other sites on this server so that may not be wise
just yet.