Strange characters added by nginx?


#1

When i am trying to run my application via fastcig nginx adds some
strange character, which are rendered by browser and destroy layout :wink:

Anyway - two examples of the same response, one is done via nginx, the
second one by plain python (django).

Any idea?

root@sensias1 [~]# nginx -v
nginx version: nginx/0.6.32
root@sensias1 [~]#

Version with nginx:

HTTP/1.1 200 OK
Server: nginx/0.6.32
Date: Tue, 04 Nov 2008 13:00:41 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: close
Vary: Accept-Language, Cookie
Content-Language: londonlist
Cache-control: no-cache, must-revalidate, max-age=3600
Set-Cookie: sessionid=20dedac7897a460f639f5eea64dc2246.1225803641.71;
expires=Tue, 18-Nov-2008 13:00:41 GMT; Max-Age=1209600; Path=/;
Set-Cookie: clipboard="{‘advert’: [], ‘query’: []}"; Path=/;

1e78

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" Version without nginx (built in web server): HTTP/1.0 200 OK Date: Tue Nov 4 13:03:58 2008 Server: WSGIServer/0.1 Python/2.4.3 Vary: Accept-Language, Cookie Content-Type: text/html; charset=utf-8 Content-Language: londonlist Cache-control: no-cache, must-revalidate, max-age=3600 Set-Cookie: sessionid=f376e7490c64adbed81eb1ddea5d98d2.1225803838.25; expires=Tue, 18-Nov-2008 13:03:58 GMT; Max-Age=1209600; Path=/; Set-Cookie: clipboard="{'advert': [], 'query': []}"; Path=/; <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

#2

Hello!

On Tue, Nov 04, 2008 at 02:06:05PM +0100, Rafał Zawadzki wrote:

root@sensias1 [~]#
Connection: close
Vary: Accept-Language, Cookie
Content-Language: londonlist
Cache-control: no-cache, must-revalidate, max-age=3600
Set-Cookie: sessionid=20dedac7897a460f639f5eea64dc2246.1225803641.71; expires=Tue, 18-Nov-2008 13:00:41 GMT; Max-Age=1209600; Path=/;
Set-Cookie: clipboard="{‘advert’: [], ‘query’: []}"; Path=/;

1e78

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

It looks like normal chunked transfer encoding, exactly as
specified in headers (note “Transfer-Encoding: chunked”). Your
browser shouldn’t render “1e78” as long as it’s HTTP/1.1 complaint
(and nginx won’t send chunked unless request is HTTP/1.1).

Could you please confirm that the output in question is what you
got on the wire, not something transcoded by your debugging tool
(if unsure - retry request by hand via telnet)? And could you
please name the browser you are using?

Maxim D.

p.s. Common problem discussed many times here involves backend
incorrectly returning chunked to nginx, resulting in double
chunked encoding sent to client. But this shouldn’t be the case
with fastcgi, it only can manifest itself with proxy_pass.


#3

Witam!

W liście datowanym 4 listopada 2008 (15:45:40) napisano:

Hello!

On Tue, Nov 04, 2008 at 02:06:05PM +0100, Rafał Zawadzki wrote:

root@sensias1 [~]#
Connection: close
Vary: Accept-Language, Cookie
Content-Language: londonlist
Cache-control: no-cache, must-revalidate, max-age=3600
Set-Cookie: sessionid=20dedac7897a460f639f5eea64dc2246.1225803641.71; expires=Tue, 18-Nov-2008 13:00:41 GMT; Max-Age=1209600; Path=/;
Set-Cookie: clipboard="{‘advert’: [], ‘query’: []}"; Path=/;

1e78

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

It looks like normal chunked transfer encoding, exactly as
specified in headers (note “Transfer-Encoding: chunked”). Your
browser shouldn’t render “1e78” as long as it’s HTTP/1.1 complaint
(and nginx won’t send chunked unless request is HTTP/1.1).

Could you please confirm that the output in question is what you
got on the wire, not something transcoded by your debugging tool
(if unsure - retry request by hand via telnet)? And could you
please name the browser you are using?

IE7

(output was taken using “netcat” tool).

Maxim D.

p.s. Common problem discussed many times here involves backend
incorrectly returning chunked to nginx, resulting in double
chunked encoding sent to client. But this shouldn’t be the case
with fastcgi, it only can manifest itself with proxy_pass.

regards,


#4

More importantly, the backend should not send chunked encoding as
nginx uses HTTP/1.0 to talk to backends.


#5

Hello!

On Wed, Nov 05, 2008 at 09:24:52AM +0100, Rafał Zawadzki wrote:

root@sensias1 [~]# nginx -v
Content-Type: text/html; charset=utf-8

IE7

(output was taken using “netcat” tool).

Sorry, can’t reproduce. Obviously IE7 understands chunked and I
see nothing strange in the headers above (and so does IE7 feeded
by the headers and some chunked data).

Try tcpdump’ing what happens on the wire for real request.

Maxim D.