HTTP2::push¶
Description¶
This command accepts a resource as a parameter that can be pushed to
the client using PUSH_PROMISE frames in HTTP/2 stream. This command
has two variants.
- The first takes a requested resource, and then sends a PUSH_PROMISE frame describing that resource to the client. The resource is requested from the server, and the payload is sent to the client on the pushed stream.
- The second method of using this command describes both the request and the response. The request is sent as a PUSH_PROMISE to the client, and the response follows. The server is not contacted, and the content is pushed directly from the BIG-IP.
Note that this command may cause iRule events to trigger on the newly
pushed stream. In particular, the HTTP_REQUEST event may fire. The
HTTP::push command will not do anything on a pushed stream. If the
response is generated by the BIG-IP, then it will have a “Server:
BIG-IP” header added by default to differentiate replies generated
from the BIG-IP versus those from actual servers. The ‘-noserver’ flag
may be used to suppress this. The “Content-Length” header is computed
and supplied automatically.
By default, a Host header is required on the request. This will be
converted into the corresponding HTTP/2 :authority header in the
PUSH_PROMISE frame. If this is unwanted, then ‘-nohost’ will disable
the checking for that.
Syntax¶
HTTP2::push <uri> [-priority <num>] [-nohost] <request header list>
HTTP2::push <uri> [-priority <num>] (-content <content> | -ifile <file>) [-noserver] [-nohost] <request header list> -- <response header list>
HTTP2::push <uri> [-priority <num> ] [-nohost] <request header list>¶
- Generates a push to the client, and asks for the indicated resource from the server. The server-generated resource will be forwarded to the client.
HTTP2::push <uri> [-priority <num>] (-content <content> | -ifile <file>) [-noserver] [-nohost] <request header list> – <response header list>¶
- Generates a push to the client. Both the pushed request and response are created from the supplied content and header values.
Examples¶
Example 1: Always push “/index.html” on every request. The contents of that file are retrieved from the server.
when HTTP_REQUEST {
HTTP2::push /index.html host example.com
}
Example 2: Push /test_push.html if /index.html is requested. If
/test_push.html is requested by a GET, then use HTTP::respond to
generate it.
when HTTP_REQUEST {
set mycontent "<HTML><HEAD><TITLE>HTTP Server</TITLE></HEAD><BODY>Test Body</BODY></HTML>\n"
if { [HTTP::uri -normalized] equals "/index.html" } {
HTTP2::push /test_push.html -content $mycontent -noserver host example.com test_reqheader test_reqvalue -- test_respheader test_respvalue
}
# Handle a GET
if { [HTTP::uri -normalized] equals "/test_push.html" } {
HTTP::respond 200 -content $mycontent -noserver test_respheader test_respvalue
}
}