[Bug] Multiline proxied response headers mangled
Laurence Rowe
l at lrowe.co.uk
Mon Apr 18 19:33:01 MSD 2011
Hi,
I hope this is the right place to report bugs. Nginx seems to have a
bug in handling multiline response headers. According to RFC 2616,
"Header fields can be extended over multiple lines by preceding each
extra line with at least one SP or HT."
http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html (and also in
HTTP 1.0 - http://www.apps.ietf.org/rfc/rfc1945.html#sec-4.2)
I've confirmed this on both Nginx 0.7.67 on Debian 6 and Nginx 1.0.0
on Mac OS X.
The following configuration replaced the default config server section:
server {
listen 8001 default;
server_name localhost _;
location / {
proxy_pass http://localhost:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme "http";
proxy_set_header Host $host;
}
A request to my backend results in:
$ curl -i -H "Accept-Encoding: gzip" http://127.0.0.1:8080/Plone/home
HTTP/1.1 200 OK
Server: Zope/(2.13.6, python 2.6.6, darwin) ZServer/1.1
Date: Mon, 18 Apr 2011 15:22:44 GMT
Content-Length: 4157
X-Cache-Operation: plone.app.caching.moderateCaching
Content-Language:
Content-Encoding: gzip
Expires: Fri, 20 Apr 2001 15:22:44 GMT
Vary: X-Anonymous,
Accept-Encoding
ETag: "||373||1|Sunburst Theme|0|0|1302790083.61"
Cache-Control: max-age=0, s-maxage=3600, must-revalidate
X-Cache-Rule: plone.content.folderView
Content-Type: text/html;charset=utf-8
But when proxied results in:
$ curl -i -H "Accept-Encoding: gzip" http://127.0.0.1:8001/Plone/home
HTTP/1.1 200 OK
Server: nginx/1.0.0
Date: Mon, 18 Apr 2011 15:20:10 GMT
Content-Type: text/html;charset=utf-8
Connection: keep-alive
Content-Length: 4148
X-Cache-Operation: plone.app.caching.moderateCaching
Content-Language:
Content-Encoding: gzip
Expires: Fri, 20 Apr 2001 15:20:10 GMT
Vary: X-Anonymous,
Accept-Encoding:
ETag: "||373||1|Sunburst Theme|0|0|1302790083.61"
Cache-Control: max-age=0, s-maxage=3600, must-revalidate
X-Cache-Rule: plone.content.folderView
Where in the proxied response the second line of the Vary header has
had an ":" appended, as if it were being interpreted as a malformed
header in its own right.
Laurence
More information about the nginx-devel
mailing list