You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@trafficserver.apache.org by Mateusz Zajakala <za...@gmail.com> on 2015/10/22 15:34:58 UTC

[ATS 5.3.0] GZIP plugin not working?

Hi,

I'd appreciate any suggestion, I'm trying to use gzip plugin and it does
not seem to work, my config is as follow:

plugin.config:
gzip.so /etc/trafficserver/gzip.config

/etc/trafficserver/gzip.config :
# Set some global options first
cache true
enabled true
remove-accept-encoding true
compressible-content-type application/json
flush true[

After that I restart ATS, see in logs:
 NOTE: loading plugin '/usr/lib64/trafficserver/plugins/gzip.so'

When I make a request to ATS from firefox:

User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:41.0)
Gecko/20100101 Firefox/41.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: pl,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Connection: keep-alive
Cache-Control: max-age=0

I get these headers in response:

HTTP/1.1 200 OK
Server: ATS/5.3.0
Access-Control-Allow-Origin: *
Expires: Thu, 22 Oct 2015 14:08:29 GMT
Cache-Control: max-age=3600
Content-Type: application/json;charset=UTF-8
Date: Thu, 22 Oct 2015 13:08:29 GMT
Age: 1075
Content-Length: 118
Connection: keep-alive


No gzip Content-Encoding.

What am I missing??

Re: [ATS 5.3.0] GZIP plugin not working?

Posted by Gancho Tenev <gt...@gmail.com>.
Hi Mateusz,

You could try running:
./bin/traffic_server -T 'gzip|http_hdrs’

It should help you figure out if the Content-Encoding header is added as expected. You should see something similar to the following:

[Oct 22 13:25:27.342] Server {0x7fc8db178700} DIAG: (gzip) DEBUG: [gzip.cc <http://gzip.cc/>:292] [gzip_transform_one] gzip_transform: deflate with Z_NO_FLUSH
+++++++++ Header From Transform +++++++++
-- State Machine Id: 0
HTTP/1.0 200 OK
Server: BaseHTTP/0.3 Python/2.6.6
Date: Thu, 22 Oct 2015 20:25:27 GMT
Content-type: application/json
Content-Encoding: gzip
Vary: Accept-Encoding

+++++++++ Base Header for Building Response +++++++++
-- State Machine Id: 0
HTTP/1.0 200 OK
Server: BaseHTTP/0.3 Python/2.6.6
Date: Thu, 22 Oct 2015 20:25:27 GMT
Content-type: application/json
Content-Encoding: gzip
Vary: Accept-Encoding

You might find other useful debug tags here: http://trafficserver.readthedocs.org/en/5.3.x/sdk/troubleshooting-tips/unable-to-debug-tags.en.html <http://trafficserver.readthedocs.org/en/5.3.x/sdk/troubleshooting-tips/unable-to-debug-tags.en.html>

I find using curl -v more practical for tests, I think it is easier to see request/response headers, etc.

HTH,

Cheers,
—Gancho


> On Oct 22, 2015, at 12:11 PM, Mateusz Zajakala <za...@gmail.com> wrote:
> 
> Gancho,
> 
> thanks a lot for the tip on how to turn on debug mode. I did and NOW I'm confused...
> 
> [Oct 22 21:06:51.790] Server {0x7f21f39027e0} DIAG: (gzip) INFO: normalized accept encoding to gzip
> [Oct 22 21:06:51.791] Server {0x7f21f39027e0} DIAG: (gzip) INFO: compressible content type [text/plain; charset=UTF-8], matched on pattern [text/*]
> [Oct 22 21:06:51.791] Server {0x7f21f39027e0} DIAG: (gzip) INFO: adding compression transform
> [Oct 22 21:06:51.791] Server {0x7f21f39027e0} DIAG: (gzip) DEBUG: [gzip.cc:292] [gzip_transform_one] gzip_transform: deflate with Z_NO_FLUSH
> [Oct 22 21:06:51.791] Server {0x7f21f39027e0} DIAG: (gzip) INFO: Compressed size 25 (bytes), Original size 5, ratio: -4.000000
> 
> Apparently the GZIP plugin does something, however still no "Content-encoding" header in the response. I check with Firebug AND Chrome, there is: Vary: Accept-Encoding header (it disappears when I switch off gzip plugin) but nothing more:
> HTTP/1.1 200 OK
> Date: Thu, 22 Oct 2015 19:08:51 GMT
> Server: ATS/5.3.0
> Last-Modified: Thu, 22 Oct 2015 14:06:49 GMT
> ETag: "c-5-522b20191dfdc-df"
> Accept-Ranges: bytes
> Content-Type: text/plain; charset=UTF-8
> Vary: Accept-Encoding
> Age: 0
> Connection: keep-alive
> Transfer-Encoding: chunked
> 
> 
> 
> What could be happening? I'm running on basically out-of-the-box records config (I changed port no) and have some remap configs present...
> 
> THanks
> 
> 
> On Thu, Oct 22, 2015 at 7:41 PM, Gancho Tenev <gttenev@gmail.com <ma...@gmail.com>> wrote:
> ./bin/traffic_server -T gzip
> 
> 


Re: [ATS 5.3.0] GZIP plugin not working?

Posted by Mateusz Zajakala <za...@gmail.com>.
Gancho,

thanks a lot for the tip on how to turn on debug mode. I did and NOW I'm
confused...

[Oct 22 21:06:51.790] Server {0x7f21f39027e0} DIAG: (gzip) INFO: normalized
accept encoding to gzip
[Oct 22 21:06:51.791] Server {0x7f21f39027e0} DIAG: (gzip) INFO:
compressible content type [text/plain; charset=UTF-8], matched on pattern
[text/*]
[Oct 22 21:06:51.791] Server {0x7f21f39027e0} DIAG: (gzip) INFO: adding
compression transform
[Oct 22 21:06:51.791] Server {0x7f21f39027e0} DIAG: (gzip) DEBUG:
[gzip.cc:292] [gzip_transform_one] gzip_transform: deflate with Z_NO_FLUSH
[Oct 22 21:06:51.791] Server {0x7f21f39027e0} DIAG: (gzip) INFO: Compressed
size 25 (bytes), Original size 5, ratio: -4.000000

Apparently the GZIP plugin does something, however still no
"Content-encoding" header in the response. I check with Firebug AND Chrome,
there is: Vary: Accept-Encoding header (it disappears when I switch off
gzip plugin) but nothing more:

   1. HTTP/1.1 200 OK Date: Thu, 22 Oct 2015 19:08:51 GMT Server: ATS/5.3.0
   Last-Modified: Thu, 22 Oct 2015 14:06:49 GMT ETag: "c-5-522b20191dfdc-df"
   Accept-Ranges: bytes Content-Type: text/plain; charset=UTF-8 Vary:
   Accept-Encoding Age: 0 Connection: keep-alive Transfer-Encoding: chunked




What could be happening? I'm running on basically out-of-the-box records
config (I changed port no) and have some remap configs present...

THanks


On Thu, Oct 22, 2015 at 7:41 PM, Gancho Tenev <gt...@gmail.com> wrote:

> ./bin/traffic_server -T gzip

Re: [ATS 5.3.0] GZIP plugin not working?

Posted by Gancho Tenev <gt...@gmail.com>.
Hi Mateusz,

I tested your gzip.config and it worked for me (you have an extra  “[“ next to the “true” value for “flush" but that impacts only if the flush would be enabled or not).

There must be something different in your case…
You could run the traffic_server in debug mode with ‘./bin/traffic_server -T gzip’ and see the log messages from the gzip plugin.

Here is what worked for me (using your gzip.config) … It is not 100% the same but at least similar… 
it also uses ATS 5.3.2 which should not make a major difference (i don’t think there were any functional changes in the plugin).

curl -s -x localhost:80 http://gzip.example.com/test.crl -H "Accept-Encoding: gzip, deflate" -v  -o /dev/null -s
* About to connect() to proxy localhost port 80 (#0)
*   Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 80 (#0)
> GET http://gzip.example.com/test.crl HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.19.1 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: gzip.example.com
> Accept: */*
> Proxy-Connection: Keep-Alive
> Accept-Encoding: gzip, deflate
> 
< HTTP/1.1 200 OK
< Server: ATS/5.3.2
< Date: Thu, 22 Oct 2015 17:22:50 GMT
< Content-type: application/json
< Content-Encoding: gzip
< Vary: Accept-Encoding
< Age: 0
< Transfer-Encoding: chunked
< Proxy-Connection: keep-alive
< Via: http/1.0 centos6 (ApacheTrafficServer/5.3.2)
< 
{ [data not shown]
* Connection #0 to host localhost left intact
* Closing connection #0

Unrelated to the problem note: I was wondering if you really need “flush true” which will run deflate with Z_SYNC_FLUSH instead of Z_NO_FLUSH (reference http://zlib.net/manual.html#Basic <http://zlib.net/manual.html#Basic>), not sure, you may have a good reason for it.

HTH.

Cheers,
—Gancho




> On Oct 22, 2015, at 6:34 AM, Mateusz Zajakala <za...@gmail.com> wrote:
> 
> Hi, 
> 
> I'd appreciate any suggestion, I'm trying to use gzip plugin and it does not seem to work, my config is as follow:
> 
> plugin.config:
> gzip.so /etc/trafficserver/gzip.config
> 
> /etc/trafficserver/gzip.config : 
> # Set some global options first
> cache true
> enabled true
> remove-accept-encoding true
> compressible-content-type application/json
> flush true[
> 
> After that I restart ATS, see in logs:
>  NOTE: loading plugin '/usr/lib64/trafficserver/plugins/gzip.so'
> 
> When I make a request to ATS from firefox:
> User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0
> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
> Accept-Language: pl,en-US;q=0.7,en;q=0.3
> Accept-Encoding: gzip, deflate
> Connection: keep-alive
> Cache-Control: max-age=0
> I get these headers in response:
> HTTP/1.1 200 OK
> Server: ATS/5.3.0
> Access-Control-Allow-Origin: *
> Expires: Thu, 22 Oct 2015 14:08:29 GMT
> Cache-Control: max-age=3600
> Content-Type: application/json;charset=UTF-8
> Date: Thu, 22 Oct 2015 13:08:29 GMT
> Age: 1075
> Content-Length: 118
> Connection: keep-alive
> 
> No gzip Content-Encoding. 
> 
> What am I missing??