HTTP/2 push with static page and standalone Jetty

128 views Asked by At

I am trying to experiment a bit with HTTP/2's push feature to get an idea of the benefits that it can bring. I have been trying to setup a Jetty server with a static page (standard html, images and css). The server works now and requests are handled over HTTP/2 as well. However, when I try to enable HTTP/2 push, I do not seem to get it working. I have verified this using both chrome dev-tools and through chrome://net-internals. Both confirm that no objects are being pushed. Below is a copy of how my web.xml file looks:

<?xml version="1.0" encoding="UTF-8"?> 
<web-app 
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
metadata-complete="true" 
version="3.1">
<filter>
    <filter-name>PushFilter</filter-name>
    <filter-class>org.eclipse.jetty.servlets.PushCacheFilter</filter-class>
    <async-supported>true</async-supported>
    <init-param>
        <param-name>ports</param-name>
        <param-value>8443</param-value>
    </init-param>
     <init-param>
        <param-name>associatePeriod</param-name>
        <param-value>1500</param-value>
    </init-param>
    <init-param>
        <param-name>maxAssociations</param-name>
        <param-value>128</param-value>
    </init-param>
</filter>
<filter-mapping>
    <filter-name>PushFilter</filter-name>
    <url-pattern>*</url-pattern>
</filter-mapping>
</web-app>

I am not sure what is wrong here. Someone please help me out.

Thanks.

1

There are 1 answers

0
sbordet On

You hit this bug.

Jetty 9.3.x series work fine, the bug will be fixed in 9.4.1, due in a couple of weeks.