This Question is Related to my earlier post here: CSS loading issue with Android ICS.
Where I was facing issue with CSS and JS rendering by Android ICS's default and Dolphin browser. This content is served from my Server's Backend Engine, Which uses (Apache2 + FastCGI + Python) setup.
While searching for possible problems, I found that main cause for problem was, content was NOT sent in compressed form from Server.
So sample Response Header looks something as follows:
Connection Keep-Alive
Content-Encoding gzip
Content-Length 5997
Content-Type text/css
Date Sun, 29 Jul 2012 14:29:08 GMT
Keep-Alive timeout=15, max=100
Server Apache (Ubuntu)
Vary Accept-Encoding
and If Same content is served from flat file. Response header looks something as below. Which is rendered properly by all Browsers.
Accept-Ranges bytes
Connection Keep-Alive
Content-Encoding gzip
Content-Length 1430
Content-Type text/css
Date Sun, 29 Jul 2012 14:28:57 GMT
Etag "a9c06-176d-4c5e693c2a6c0"
Keep-Alive timeout=15, max=100
Last-Modified Sat, 28 Jul 2012 16:46:59 GMT
Server Apache (Ubuntu)
Vary Accept-Encoding
and Some How, Android ICS's default and dolphin Browser are not able to render the content (Specially css, js content). It works with all other Browsers.
But Essentially, there is some problem with Backend engine also because of which uncompressed data is sent. There are few Interesting points here to look, in Response header:
- Response Header contains field that says "Content-Encoding gzip"
- But the Content-Length shows the length of Uncompressed version of resource.
To solve the problem I tried few small changes in Architecture, in places where I thought could be a problem cause. I noticed, replacing the fastCGI by CGI solved my Problem and data is sent in Compressed Format now.
Problem
Though the problem is solved but I definitely want to use fastCGI. So I am looking for possible configuration changes that can solve Problem. I have done following Arrangements in Server's Apache settings:
- Enabling deflate module from Available Apache modules.
My
/etc/apache2/mods-enabled/deflate.conf
files has following text:<IfModule mod_deflate.c> # these are known to be safe with MSIE 6 AddOutputFilterByType DEFLATE text/html text/plain text/xml # everything else may cause problems with MSIE 6 AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript AddOutputFilterByType DEFLATE application/rss+xml </IfModule>
I have following lines to make fastCGI work with my script in
/etc/apache2/sites-enabled/default
file.<Files my_script_name.py> SetHandler fastcgi-script </Files> FastCgiServer /path_to_script/my_script_name.py -processes 4 -socket /tmp/my_script_name.sock
Question
I tried various configuration changes But None of them seems to be solving my Problem. Is there any thing that I am missing here to Enable compression with fastCGI?