HTTP2

Description

iRules commands for working with HTTP2 connections.
Note: If you are using a HTTP2 profile in versions before 14.1, TCL variables set before the HTTP_REQUEST event are not carried over to further events. See examples below the command list for workarounds.

Commands

  • HTTP2::active - used to determine if a request is generated by HTTP/2
  • HTTP2::disable - changes the HTTP2 filter from full parsing to passthrough mode
  • HTTP2::disconnect - allows you to cleanly terminate the current HTTP/2 session
  • HTTP2::enable - changes the HTTP2 filter from passthrough to full parsing mode
  • HTTP2::header - queries or modifies HTTP/2 pseudo-headers
  • HTTP2::push - accepts a resource as a parameter that can be pushed to the client using PUSH_PROMISE frames
  • HTTP2::requests - used to determine the count of requests received in the current HTTP/2 session
  • HTTP2::stream - Gets or sets the stream attributes including id and priority
  • HTTP2::version - used to determine the HTTP/2 protocol version used
  • HTTP2::concurrency - used to determine the number of active concurrent streams in the current HTTP/2 session

Failing Example before workaround
when CLIENT_ACCEPTED {
  set default_pool [LB::server pool]
}
when HTTP_REQUEST {
  log local0. "HTTP_REQUEST EVENT Client [IP::client_addr]:[TCP::client_port] -- $default_pool --"       #<--- This will throw an error.
}
# Error Messsage: *** err tmm1[19652]: 01220001:3:
# TCL error: /Common/test-http2 <HTTP_REQUEST>
# - can't read "default_pool": no such variable while executing "log local0. "HTTP_REQUEST EVENT -- $default_pool --"

Workaround using tables for variables before HTTP_REQUEST
when CLIENT_ACCEPTED {
  table set [IP::client_addr]:[TCP::client_port] [LB::server pool]
}
when HTTP_REQUEST {
  set default_pool [table lookup [IP::client_addr]:[TCP::client_port]]
  log local0. "POOL: |$default_pool|"
}

The BIG-IP API Reference documentation contains community-contributed content. F5 does not monitor or control community code contributions. We make no guarantees or warranties regarding the available code, and it may contain errors, defects, bugs, inaccuracies, or security vulnerabilities. Your access to and use of any code available in the BIG-IP API reference guides is solely at your own risk.