nginx with data compression on java applet

hirantha hirantha at securedpipe.net
Sun Mar 15 20:48:43 MSK 2009


Thanks guys,

It is working as expected...!

And thanks to nginx guys, this is amazing service.

Regards
Hirantha

Nick Pearson wrote:
> Depends on how the applet is written, I'd guess.  Not sure though.  
> However, if compression is very important and accepting gzipped content 
> is not possible with an applet, you could gzip the files beforehand so 
> that the files that are served are gzipped already (even though there's 
> no Accept-Encoding header).  This would of course require that the 
> applet decompress the text before processing, but at least you'd cut 
> down on your network traffic...
> 
> On Sat, Mar 14, 2009 at 2:58 PM, hirantha <hirantha at securedpipe.net 
> <mailto:hirantha at securedpipe.net>> wrote:
> 
>     Thanks guys for the replies..
> 
> 
> 
>     Igor Sysoev wrote:
> 
>         On Sat, Mar 14, 2009 at 02:11:38AM +0530, hirantha wrote:
> 
>             Hi ALL,
> 
>             I am very new to nginx, and I found the nginx is the perfect
>             tool for me to do reverse-proxy while compressing the data.
>             I have successfully configured the proxy_pass and gzip
>             configurations and it is working as I expected in test
>             environments.
> 
>             We have web servers which streaming text data through java
>             applet to the end users. Nginx is act as a reverse-proxy for
>             back-end web servers; once the java applet loaded on the
>             FireFox or IE browser it keep receiving data without any
>             issue. But the problem is those text data won't get
>             compressed though text, images etc loaded to the browser get
>             compressed. I can compress data off the applet but once it
>             send it to java applet, won't get compressed.
> 
> 
>         It seems that java applet does not send the "Accept-Encoding: gzip"
>         request header.
> 
> 
>     I ran Wireshark to analyze the data on java applet and firefox
>     browser to check what type of header request they send. Here are my
>     findings.
> 
>      >From browser:
>     GET /mbr/ds.aspx?SID=1F5AAWQWQWSA1 HTTP/1.1
>     Host: data.example.com <http://data.example.com>
>     User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.7)
>     Gecko/2009030503 Fedora/3.0.7-1.fc10 Firefox/3.0.7
>     Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
>     Accept-Language: en-us,en;q=0.5
>     Accept-Encoding: gzip,deflate
>     Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
>     Keep-Alive: 300
>     Connection: keep-alive
> 
> 
>      >From Java applet loaded from Firefox:
>     GET /sabb/GetUserParams.aspx?Y=BC672 HTTP/1.1
>     User-Agent: Java(tm) 2 SDK, Standard Edition v1.6.0_0 Java/1.6.0_0
>     Host: data.example.com <http://data.example.com>
>     Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
>     Connection: keep-alive
> 
>     I think java applet don't sends Accept-Encoding header to the
>     server; and this should be the problem. I am not a java expert and
>     the new question, is this possible with a java applet set
>     Accept-Encoding request header...?
> 
> 
> 
>         BTW why do you compress image/gif image/jpeg image/png ?
>         This is just waste of CPU time.
> 
> 
>     Yes, I have to avoid them, my concern is huge text data.
> 
>     Any advice on the new question is really appreciated.
> 
> 
>     Regards
>     Hirantha
> 
> 
>             Here is my nginx.conf:
> 
>             http {
>               include       mime.types;
>               default_type  application/octet-stream;
>               sendfile        on;
>               keepalive_timeout  65;
>             # compression
>               gzip on;
>               gzip_http_version 1.0;
>               gzip_comp_level 4;
>               gzip_proxied private;
>               gzip_min_length  1100;
>               gzip_buffers 16 8k;
>               gzip_types text/plain text/html text/css
>             application/x-javascript \
>                   text/xml application/xml application/xml+rss
>             text/javascript \
>                   image/gif image/jpeg image/png;
>               gzip_disable "MSIE [1-6].(?!.*SV1)";
>               gzip_vary on;
>               server {
>                   listen       80;
>                   server_name  localhost;
> 
> 
>               location / {
>                   proxy_pass         http://data.example.com/;
>                   proxy_redirect     off;
> 
>                   proxy_set_header   Host             $host;
>                   proxy_set_header   X-Real-IP        $remote_addr;
>                   proxy_set_header   X-Forwarded-For
>              $proxy_add_x_forwarded_for;
>                   proxy_max_temp_file_size 0;
> 
>                   client_max_body_size       10m;
>                   client_body_buffer_size    128k;
> 
>                   proxy_connect_timeout      90;
>                   proxy_send_timeout         90;
>                   proxy_read_timeout         90;
> 
>                   proxy_buffer_size          4k;
>                   proxy_buffers              4 32k;
>                   proxy_busy_buffers_size    64k;
>                   proxy_temp_file_write_size 64k;
> 
>                   }
>                   error_page   500 502 503 504  /50x.html;
>                   location = /50x.html {
>                       root   /usr/local/www/nginx-dist;
>                   }
> 
>               }
> 
> 
>             I'm Running on FreeBSD7.1 and I googled such scenario but no
>             luck. To get this done where do I have to looking in to..?
>             Any advice is really appreciated
> 
>             Thanks in advance
>             Hirantha
> 
> 
> 
> 





More information about the nginx mailing list