Version notice:
RULE_INIT¶
Description¶
Use this event to initialize global or static
variables used within iRules.
Execution¶
This event is triggered under the following conditions;
- when an iRule using the event is saved.
- when the device starts up.
- when the software is restarted.
Scope¶
The RULE_INIT event is global in scope and is triggered without the
context of a virtual server or client to virtual server connection.
Namespace¶
Variables defined in this event are global across the F5 and share the
same namespace with all other iRules. Any other irule that also sets a
variable with the same name in another RULE_INIT event will overwrite
the previously set value.
Limitations¶
Global variables modified by an iRule will demote the execution of the
virtual to a single processor core. On a BIG-IP with a quad core
processor, the virtual will only be able to use one of them. See CMP
Compatibility for more details.
Examples¶
when RULE_INIT {
set ::count 0
}
# static namespace is available in 10.0.0+
when RULE_INIT {
set static::debug 1
}
Related Information¶
Available Commands:
- LSN::disable - Disable LSN translation.
Warning
The links to the sample code below are remnants of the old DevCentral wiki and will result in a 404 error. For best results, please copy the link text and search the codeshare directly on DevCentral.
Sample Code:
- ASP Session ID Persistence - Persist on ASP SessionID cookie value or PID.
- Base32 Encoder/Decoder - Code to encode and decode Base32 strings
- Credit Card Scrubber Using a Stream Profile - This iRule illustrates how to scrub out Credit Card Numbers from HTTP traffic using a STREAM profile.
- CSV Tabular Data Sideband Importer - This iRule adds the ability to import CSV-formatted tabular data to a table via an HTTP sideband connection.
- Data Leakage Protection - Scrub sensitive data from application responses
- Destination Snat Using DNS - This iRule. selects a snatpool based on which virtual called the iRule. and will select the member servers to use based on DNS resolution.
- DNS Flood Protection v1 - This iRule illustrates how to provide flood protection per source IP address.
- DNS Flood Protection v3 - This iRule illustrates how to provide flood protection per source IP address.
- dummy SMTP server - This is basic iRule which acts as a standalone SMTP server. I needed this w…
- Encrypting Cookies - This example shows how to encrypt and decrypt a HTTP cookie from within an iRule.
- Exchange2010 SNAT pool persistence - Applies a type of persistence per incoming IP to the SNAT pool masquerading IPs assigned to CAS RPC connections
- File Not Found Handler - This iRule will handle HTTP 404 (File Not Found) errors returned from pool members and return an embedded customized error page.
- FIX Select Pool Based On Sender Comp ID - Financial Information eXchange (FIX) Protocol iRule to select pool based on Sender Comp ID.
- Fowler Noll Vo (FNV) Hash Calculation - This sample iRule shows how to calculate FNV or Fowler / Noll / Vo Hash.
- high performance rate limiting - This rule will limit the number of request to a particular vhost and uri to…
- HMAC - This iRule shows example of to calculate HMAC or keyed-Hash Message Authent…
- HTTP delay and validate clients using javascript cookies when CPU overloaded - If CPU usage high. delay clients and validate they’re real by making sure they can execute javascript.
- … - If CPU usage is over $::maxcpu (default 60%). send the client javascript th…
- HTTP POST redirect preserving POST data - Use Javascript in an iRule to redirect HTTP POST requests to HTTPS
- HTTP session limit - HTTP Session limiting for LTM v10.1 using tables.
- HTTP and HTTPS on a single virtual server - iRule to support a virtual server on port 0 and a client SSL profile. and a…
- HTTP Request Throttle - iRule to dynamically throttle HTTP request rate by client IP.
- HTTP Session Limit - Limits total concurrent HTTP sessions to a pre-defined threshhold. allowing those clients with a session cookie to continue once the limit is reached. while redirecting new clients until con…
- HTTP slow post mitigation - Mitigating Slow HTTP Post DDoS Attacks With iRules
- Hunt The Wumpus - For all you “Hunt the Wumpus” fans out there. here’s an iRule clone implemented on top of the FTP protocol.
- iRule_for_passive_ftps_in_ccc_mode - When using ftps with ccc-mode (clear command channel) the ftp-profile on LT…
- LDAP Pool Selection By IP For Mobile Devices - Distributes traffic to different pools based on LOGIN-IP address in LDAP request data.
- LDAP Proxy - An LDAP proxy used send read/write requests to different pools.
- Limit Connections From Client - Limit the number of TCP connections to a virtual server from client IP addresses.
- Load balancing based on ASP SessionID - The code separates into 2 irules. one for request and one for response. T…
- Log Every X Seconds - This example shows how to throttle log messages so a message is only logged every X number of seconds.
- LTM Image Hosting - Host Images on LTM in External Class
- NAT_iRule - This is a solution that allows client from IPv6 network to communicate to IPv4 network thru BIG-IP.
- NEDS Rule - Used in conjunction with the NEDS specification contained in the Logging and Reporting Toolkit
- Outlook Anywhere Persistence with Cookie Backup - The deployment guide for Microsoft Exchange Server 2007 (http://www.f5.com/…
- Parse username from HTTP requests - Parse the username from HTTP requests in the basic auth header and POST data
- Persistence Cookie Logger - Extracts the cookie value from a persistence cookie inserted by LTM’s “cookie insert” persistence method
- POST Request Exponential Backoff - Exponential backoff iRule to thwart dictionary attacks
- ProxyPass Lite - This iRule implements a limited subset of the full ProxyPassV10 iRule:
- RADIUS Load Balancing - An iRule to load balance RADIUS requests.
- random letter generator - This iRule demonstrates how to generate a string of random letters
- Rate Limit HTTP Requests - Limits HTTP POST requests by user
- Reverse Proxy With Basic SSO - The iRule implements a authenticated HTTPS reverse proxy.
- Rewrite Host Header to Server Name - On each HTTP request. the selected pool member IP address is looked up against a datagroup and the corresponding hostname is inserted in the HTTP host header.
- Sideband connection HTTP example - Sends an HTTP request to a sideband server and parses the HTTP response headers and optionally the payload to determine which pool to send the client request to
- SMTP filter and forward proxy - SMTP filter and forward proxy
- SNAT pool persistence - This example shows how to select the same SNAT address for a given client IP address without tracking the selection in memory
- Split records across many subtables for better distribution across TMMs - Use multiple subtables to store session table entries
- SUPL ILP Message Based Load Balancing with Persistence - SUPL ILP message-based load-balancing
- TFTP server - This rule implements a very basic tftp server within an iRule. calling an e…
- Time based iRule example - Take action in an iRule based on a time window
- Uri version mapping - This rule implements a stripped down set of functionality of the ProxyPass …
- Validate String Characters In Cookie Rule - This rule demonstrates how to efficiently validate whether a given string contains illegal characters.
- Version 9.x robot and request limiting iRule - This iRule limits robots and what they can do. Furthermore. it restricts re…
- Version 9.x session limiting - Contributed by: David Homoney - Senior Consultant F5 Networks - d.homoney (…
- Virtual server connection limit with HTTP response - This rule allows administrators to configure a maximum TCP connection limit…
- Introduced: BIGIP-9.0.0
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.