1

If I enable H2 for my apache server and specify a preloaded link header on a HTML Dokument, the server performs a H2 server-push because it parses the Link header -- so far so good.

The problem is that this pushed resource is delivered without compression.
I guess that's because a server-push doesn't create a HTTP request and therefore the accept-encoding request header is not provided. The thing is, I don't get any performance improvements if the client has to download the uncompressed content. Is it still possible to serve the content compressed? Maybe based on the accept-encoding request header from the HTML document?

My apache config:

<VirtualHost *:443>
    Protocols h2 http/1.1
    [...]
    <Location /index.html>
        Header add Link "</css/all.min.css>;rel=preload;as=style"
    </Location>
    [...]
</VirtualHost>

The HTML Headers:

Request headers from the HTML document

accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
accept-encoding:gzip, deflate, sdch, br
accept-language:de,en-US;q=0.8,en;q=0.6
cache-control:no-cache

Response headers from the HTML document

accept-ranges:bytes
cache-control:no-transform,public,max-age=300,s-maxage=900
content-encoding:gzip
content-length:2183
content-type:text/html
etag:"2472-5385af4b7bbda-gzip"
last-modified:Sun, 24 Jul 2016 05:29:47 GMT
link:</css/all.min.css>;rel=preload;as=style
server:Apache/2.4.18 (Debian)
status:200
vary:Accept-Encoding

Response headers from /css/all.min.css

accept-ranges:bytes
cache-control:no-transform,public,max-age=300,s-maxage=900
content-length:14237
content-type:text/css
etag:"379d-5385af4b9139b"
last-modified:Sun, 24 Jul 2016 05:29:47 GMT
server:Apache/2.4.18 (Debian)
status:200
vary:Accept-Encoding
3

It seems like this is simply a bug in mod_http2, but it was fixed with version 1.2.6: https://github.com/icing/mod_h2/issues/86

-1

I think you should use mod_deflate:

http://httpd.apache.org/docs/current/mod/mod_deflate.html#enable

  • This would be a much better answer if you explained why you think mod_deflate should be used. – EEAA Jul 24 '16 at 21:09
  • It is not like compression wouldn't work at all, it just doesn't works for resources delivered with a server-push. – Moritz Jul 24 '16 at 21:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.