Forums / Cotonti / Support / gzip on nginx - buggy?

Eugene
#1 2012-01-12 19:03

For several month time to time I was getting the same error on different sites:

- in case of switching OFF gzip - in top left corner of browser 4 digits|symbols appear (like "348a")

- in case of switching gzip ON - in attempt to edit page - browser respond about "Content Encoding Error/ The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression"

Debugging make me sure that those numbers are not from any variable of CMF, so asked hoster support to figure out. I find out that hoster using nginx for "proxying" the request (I think it's became more and more popular)

But I want you to consider their reply here:

В коде Вашей CMS используется протокол HTTP/1.1, например:
[root@]# grep -i -r "HTTP/1" *
rc.php: header('HTTP/1.1 400 Bad Request');
rc.php: header('HTTP/1.1 404 Not Found');
rc.php: header('HTTP/1.1 304 Not Modified');
system/functions.php: header('HTTP/1.1 ' . $response_code);
system/functions.php: header('HTTP/1.1 ' . $env['status']);
system/functions.php: header('HTTP/1.1 ' . $env['status']);
system/cache.php: header('HTTP/1.1 304 Not Modified');
watermark.php: header('HTTP/1.1 403 Forbidden');
watermark_users.php: header('HTTP/1.1 403 Forbidden');

nginx не может корректно обрабатывать протокола HTTP/1.1 .
В таких случаях мы рекомендуем использовать в коде сайтов протокол HTTP/1.0.
Так же возможен вариант переноса сайтов на CloudServer, где можно будет не устанавливать nginx в качестве фронтенда к apache.

They say that nginx is not working properly with HTTP/1.1 - better to use 1.0 version...

Do you think better edit headings for HTTP protocol ? How to solve gzip compression problem - I think it is big factor of perfomance?

Kilandor
#2 2012-01-13 03:45
#32558 Eugene:

For several month time to time I was getting the same error on different sites:

- in case of switching OFF gzip - in top left corner of browser 4 digits|symbols appear (like "348a")

- in case of switching gzip ON - in attempt to edit page - browser respond about "Content Encoding Error/ The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression"

 

The 4 symbols sounds like there are some file that have a UTF BOM header This will cause the exact problem(s) (gzip on or off) of 4 characters in upper left corner. Usually its not a problem for most systems although this is known and all core cotonti files should be without it but its easy something could have slipped through with multiple developers using different tools and such. Or it could be a 3rd party plugin.

I don't know of a batch converter offhand but I think using iconv with nix* you can batch convert I seen a few guides looking around. For windows Notepad++ can convert the files, yet you can't batch convert them but you can only do it one by 1

esclkm
#3 2012-01-13 04:32
этот баг был исправлен в гитхуб версии. смотрите functions.php. странно у русских он быстрее всплыл чем где либо. фунция которая исправлена cot_sendheaders bug was fuxed over 2weeks ago. see functions.php
littledev.ru - мой маленький зарождающийся блог о котонти.
снижение стоимости программирования и снижение стоимости производства разные вещи. Первое можно скорее сравнить с раздачей работникам дешевых инструментов, чем со снижением зарплаты
Kilandor
#4 2012-01-13 05:57
#32570 esclkm:
этот баг был исправлен в гитхуб версии. смотрите functions.php. странно у русских он быстрее всплыл чем где либо. фунция которая исправлена cot_sendheaders bug was fuxed over 2weeks ago. see functions.php
 

His problem appears to be with UTF BOM which has nothign to do with cot_sendheaders Its an issue i've seen before some server setups do not properly handle UTF files with a BOM (Byte Order Mark). This will always prevent you from using GZIP output and having it disabled will allow the page to process, but cause 4 characters to appear in the upper left usually. If its not seen on every page, its probally a specific file, or just a couple of files that are encoded with BOM

Trustmaster
#5 2012-01-13 07:32

That's not a BOM mark, that's Chunked Content-Encoding chunk size. Esclkm is right, it is a bug fixed in this commit.

May the Source be with you!
Eugene
#6 2012-01-13 08:06

Guys, thank you very much!!!

experience rules! I glad that I turned to you for advice...

Kilandor is right about BOM, cause exactly with 2 sites where I experience this bug - I got it through development process (One guy re-save theme files with BOM)

But, your fix, esclkm, is working great! Thank you very much for that. That's right on target. I've got this ussue around summer, but never was able to fix it myself.

Question: are you going to fix  rc.php - there we have sending of headers also... (like in case of error)

thank you again. Wish all the best to Cotonti CMF!  ;)

esclkm
#7 2012-01-13 12:26

thanx make total fix for all files )

littledev.ru - мой маленький зарождающийся блог о котонти.
снижение стоимости программирования и снижение стоимости производства разные вещи. Первое можно скорее сравнить с раздачей работникам дешевых инструментов, чем со снижением зарплаты
Kilandor
#8 2012-01-13 21:59

Ah well my bad :)

As long as its wokring for you better now thats all that matters :)