F5 iRules Data Plane Programmability > 2. Cooking with iRules - HTTP > 2.1.1. Cooking with iRules Labs Source | Edit on
2.1.1.5. Lab 5 - HTTP Payload ManipulationΒΆ
Collect an HTTP payload, change it, and release it to the client. As in the previous lab replace Damn with Darn, or get creative. We arent going to use a stream profile this time we are using an HTTP::payload command instead.
Important
- Estimated completion time: 20 minutes
Open Chrome Browser
Enter https://bigip1 into the address bar and hit Enter
- Login with username: admin
- password: admin.F5demo.com
Click Local Traffic -> iRules -> iRules List
Click Create button
Click Create button
Enter Name of HTTP_Payload_iRule
Enter Your Code
Click Finished
Click Local Traffic -> Virtual Servers -> Virtual Server List
Click on http_irules_vip
Click on the Resources tab.
Click Manage button for the iRules section.
What should you do here? (Hint: Remove Stream_iRule and replace with HTTP_Payload_iRule)
Click the Finished button
Open the Firefox browser
Enter https://dvwa.f5lab.com and ensure you get there and it is HTTPS
Hint
Basic Hint
if you need a hint here is some example code:
Link to DevCentral: https://clouddocs.f5.com/api/irules/HTTP__collect.html
Link to DevCentral: https://clouddocs.f5.com/api/irules/HTTP__release.html
If you are really stuck, here is what we are looking for:
- When HTTP_Request comes in
- Second change the version of HTTP and disable compression for the request
- When HTTP_RESPONSE comes back
- Next we need to collect some HTTP::collect some data.
- Now when we get HTTP_RESPONSE_DATA
- Now we will set some find and replace strings.
- Finally we will perform a regsub on the payload and replace with new text.
- Now you should have enough to understand and the majority of code to create the iRule. If not here is the complete iRule.