Forum: NGINX Strange characters added by nginx?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A365dd9e733046a70bfbf9df335247a4?d=identicon&s=25 Rafał Zawadzki (Guest)
on 2008-11-04 14:16
(Received via mailing list)
When i am trying to run my application via fastcig nginx adds some
strange character, which are rendered by browser and destroy layout ;)

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"
A8108a0961c6087c43cda32c8616dcba?d=identicon&s=25 Maxim Dounin (Guest)
on 2008-11-04 15:54
(Received via mailing list)
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 Dounin

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.
A365dd9e733046a70bfbf9df335247a4?d=identicon&s=25 Rafał Zawadzki (Guest)
on 2008-11-05 09:32
(Received via mailing list)
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 Dounin

> 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,
A8108a0961c6087c43cda32c8616dcba?d=identicon&s=25 Maxim Dounin (Guest)
on 2008-11-05 11:07
(Received via mailing list)
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 Dounin
Fda08117336cfde6562315df04b976e8?d=identicon&s=25 Dave Cheney (Guest)
on 2008-11-05 11:17
(Received via mailing list)
More importantly, the backend should not send chunked encoding as
nginx uses HTTP/1.0 to talk to backends.
This topic is locked and can not be replied to.