h2.push

VOIDh2.pushSTRINGresourceSTRINGas

Available inall subroutines.

Preemptively sends a response to the client for resource. The push will happen immediately when the function executes, regardless of what happens with the request being processed.

The pushed resource can be a relative or absolute path, but must share the same host as the current request.

Clients can disable pushes via the SETTINGS frame and a given resource will only be pushed once per connection.

Example

sub vcl_recv() {
if (fastly_info.is_h2 && req.url == "/") {
h2.push("/style.css");
h2.push("/script.js");
h2.push("img.jpg");
}
}

User contributed notes

BETA

Do you see an error in this page? Do you have an interesting use case, example or edge case people should know about? Share your knowledge and help people who are reading this page! (Comments are moderated; for support, please contact Fastly support)