Category Archives: .net-cf-3.5

Apache gzip not working

I am trying to enable apache to gzip responses. I am on Windows 7, using Apache 2.2. I have my own module mod_myModule.so that is serving requests comming from device (.NETCF3.5 client) and sending back SOAP response to the client.

I did following, all in my httpd.conf file: 1. uncommented this line

LoadModule deflate_module modules/mod_deflate.so
  1. this already existed in httpd.conf so did not change anything but I did try to uncomment DeflateCompressionLevel 9 but if uncommented, I was not able to start Apache:

    # Insert filter SetOutputFilter DEFLATE

    # compress text, html, javascript, css, xml:
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/json
    AddOutputFilterByType DEFLATE application/x-javascript
    
    #DeflateCompressionLevel 9  //UNCOMMENTING THIS WONT ALLOW APACHE TO START
    # 1 to 9: 9 is the most compressed
    
    # Netscape 4.x has some problems...
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    
    # Netscape 4.06-4.08 have some more problems
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    
    # MSIE masquerades as Netscape, but it is fine
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
    
    # NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
    # the above regex won't work. You can use the following
    # workaround to get the desired effect:
    BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
    
    #The following statement indicate which document types not to compress. Many type of documents do not compress well.
    #At the end (Appendix 1) of this article some more type you might wish to also exclude from compression
    # Don't compress images
    SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
    SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
    SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary
    
    # Make sure proxies don't deliver the wrong content
    # install/enable the Apache module mod_headers
    Header append Vary User-Agent env=!dont-vary
    
    # install/enable the Apache module LoadModule expires_module modules/mod_expires.so
    # turn on the module for this directory
    ExpiresActive on
    
    # set defaults
    ExpiresByType text/javascript "modification plus 11 months"
    ExpiresByType application/javascript "modification plus 11 months"
    ExpiresByType text/css "modification plus 11 months"
    

However, my HttpWebResponse.ContextEncoding is "" rather than "gzip" as I understand it should be.

What I am missing?

Thank you,

Apache gzip SOAP

I am new to Apache and I am trying to figure out how to enable gzip compression to send data over to clients (.NET Compact Framework devices). I am using Apache 2.2 and so far, I have enabled mod_deflate.so but my content send over netwrok is not gzipped. Any idea? much appreciated

UPDATE I am on Windows using Apache 2.2. In my httpd.conf file, I uncommented this line

LoadModule deflate_module modules/mod_deflate.so

And in httpd.conf file, I already had all this, so nothing was changed here except that I have uncommented DeflateCompressionLevel 9:

<Location />
    # Insert filter
    SetOutputFilter DEFLATE

    # compress text, html, javascript, css, xml:
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/json
    AddOutputFilterByType DEFLATE application/x-javascript

    #DeflateCompressionLevel 9  //if I uncomment this, server wont start
    # 1 to 9: 9 is the most compressed

    # Netscape 4.x has some problems...
    BrowserMatch ^Mozilla/4 gzip-only-text/html

    # Netscape 4.06-4.08 have some more problems
    BrowserMatch ^Mozilla/4\.0[678] no-gzip

    # MSIE masquerades as Netscape, but it is fine
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

    # NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
    # the above regex won't work. You can use the following
    # workaround to get the desired effect:
    BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

    #The following statement indicate which document types not to compress. Many type of documents do not compress well.
    #At the end (Appendix 1) of this article some more type you might wish to also exclude from compression
    # Don't compress images
    SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
    SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
    SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary

    # Make sure proxies don't deliver the wrong content
    # install/enable the Apache module mod_headers
    Header append Vary User-Agent env=!dont-vary

    # install/enable the Apache module LoadModule expires_module modules/mod_expires.so
    # turn on the module for this directory
    ExpiresActive on

    # set defaults
    ExpiresByType text/javascript "modification plus 11 months"
    ExpiresByType application/javascript "modification plus 11 months"
    ExpiresByType text/css "modification plus 11 months"

</Location>

Then I restart Apache, send request to it and receive response but response.ContentEncoding does not show "gzip" in .NETCF client. It looks like I am missing something.

.NET CF / Apache – Sending and Receiving Compressed Data

I am writing a .NETCF 3.5 client on Windows Mobile device that talks to the database through an Apache (2.2) shared module using SOAP/XML web services. All that is working fine but some objects we transfer are quite large and it takes 1-2 min to receive the data on the device.
We know our database side is very fast and the only part that we can think of being slow is the part where data is serialized to be sent over the network to device. I started looking into compressing the data before sending it but I am Apache novice and I have found that there is mod_deflate shared object used for that. How do I enable compression on Apache side to compress my SOAP/XML messages to clients? How do clients decompress the data? Thanks,