Jetty Logo
Version: 9.2.11-SNAPSHOT
Contact the core Jetty developers at

private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services from 1 day to full product delivery

Configuring SPDY push

Configuring ReferrerPushStrategy
Try it!

SPDY push allows the server to send multiple resources to the client for a single client request. This will reduce the amount of round-trips and can significantly improve page load times. A full page load from germany to via SPDY and without push takes ~3s. The same request with push enabled takes only ~1s.

To enable push in Jetty the SPDY connector needs to be configured with an implementation ofPushStrategy. For each request Jetty will call the PushStrategy's apply method which will return a Set with the resources to push.


The ReferrerPushStrategy is a PushStrategy implementation that will use the HTTP "referer" header to identify if a resource belongs to a main resource.

A step by step example of how this works:

  • client requests index.html

  • client parses index.html and requests style.css, image1.png and image2.png setting the referer header to index.html for these requests.

  • ReferrerPushStrategy will use this information to associate the subresources to index .html

  • The next request to index.html from another client will get all subresources pushed without further requests

This will also work for nested subresources. E.g. a pushed style.css might initiate further resource pushes for subresources referred to by the style.css stylesheet.


The referrerPushPeriod setting will define the time that ReferrerPushStrategy will record subresources after the initial request. If this period has elapsed no further subresources will be recorded.

Configuring ReferrerPushStrategy

In the Jetty etc directory you will find jetty-spdy.xml file which can be modified to suit your needs. It contains a commented ReferrerPushStrategy configuration.

An example ReferrerPushStrategy configuration can look as follows:

Note the commented parts that let you restrict the User-Agents and file extensions.

Important Options:


If referrerPushPeriod has elapsed after the initial request to a mainresource, no more subresources will be added to the push cache.


The maximum amount of subresources being pushed for a single main resource.

Then you have to add the configured ReferrerPushStrategy to the connection factory as follows.


In the default config provided with Jetty the pushStrategy argument is commented out!

See the javadocs for ReferrerPushStrategy and sources for further details if needed.


Visit with a browser that supports push (e.g. a recent chrome browser) to see it in action.

Try it!

To verify if your setup works fine you can use chrome and it's very useful chrome://net-internals/#spdy page. Open that page in a tab of your browser. Then make sure you load a main resource of your application to fill the push cache. Then reload the page bypassing the browser's cache (STRG+SHIFT+R or CMD+SHIFT+R on OSX).

Chrome's net-internals page should tell you how many resources have been pushed and actually pushed and claimed (actually needed and used by the browser)

Another option is to enable debug logging for ReferrerPushStrategy or org.eclipse.jetty.spdy. Have a look at the Chapter 21, Jetty Logging for details.

See an error or something missing? Contribute to this documentation at Github!(Generated: 2015-04-27T01:01:14+00:00)