How to make apache deliver a file in encoded format

I check to see if my application processes the contents of a file passed through encoded encoding mode. I'm not sure what changes to make to the httpd.conf file to force encoding through Apache. Is it possible to do this with an Apache server, if not something that would be easier? I am using Apache 2.4.2 and HTTP 1.1.

By default, keep-alive is enabled in Apache, and I don’t see the data being tagged when testing with wirehark.

EDIT: Added more info:

+5
source share
2 answers

Only in this way I managed to do this by turning on the deflation module. Then I configured my client to send the header "Accept-Encoding: gzip, deflate", and apache compressed and sent the file back in chunked mode. However, I had to include the file type in the module. AddOutputFilterByType DEFLATE image/png

See an example:

curl --raw -v --header "Accept-Encoding: gzip, deflate" http://localhost/image.png | more
* Connected to localhost (127.0.0.1) port 80 (#0)
> GET /image.png HTTP/1.1
> User-Agent: curl/7.35.0
> Host: localhost
> Accept: */*
> Accept-Encoding: gzip, deflate
> 
< HTTP/1.1 200 OK
< Date: Mon, 13 Apr 2015 10:08:45 GMT
* Server Apache/2.4.7 (Ubuntu) is not blacklisted
< Server: Apache/2.4.7 (Ubuntu)
< Last-Modified: Mon, 13 Apr 2015 09:48:53 GMT
< ETag: "3b5306-5139805976dae-gzip"
< Accept-Ranges: bytes
< Vary: Accept-Encoding
< Content-Encoding: gzip
< Transfer-Encoding: chunked
< Content-Type: image/png
< 
+1
source

This resource generates the results http://www.httpwatch.com/httpgallery/chunked/ which is very useful for testing clients. You can see it by running

$ curl --raw -i http://www.httpwatch.com/httpgallery/chunked/
HTTP/1.1 200 OK
Cache-Control: private,Public
Transfer-Encoding: chunked
Content-Type: text/html
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Mon, 22 Jul 2013 09:41:04 GMT

7b
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

2d
<html xmlns="http://www.w3.org/1999/xhtml">
....
-1
source

All Articles