HTTP Rewrite of APM Webtop via iRule not functioning
I am working on a project to re-write an APM webtop with dynamic data, and have encountered an issue with capturing an XML file that is part of the webtop using an iRule. I have the exact same rule written for two separate files, one works, the other does not. I'm attaching a simplified version of the rule that logs the HTTP request, the variable that is being used to flag the capture of data in the response, and the response. Starting in version 12, the webtop is delivered in two XML files. I am able to capture and re-write the resource_info_v2.xml file without issue. I'm expanding the rule to document the payload of the request to ensure that the response for these two requests are not being combined in a single response. Any help would be greatly appreciated!
ISSUE: When using the irule below to capture the request for resource_list.xml, the attribute used to flag the capture of the HTTP::response information is reset by another HTTP request.
Files to capture: resource_list.xml which defines the lists of links on the webtop. resource_info_v2.xml which defines the specific links attributes on the webtop.
when CLIENT_ACCEPTED {
Required in order to fire HTTP_* events on an APM enabled virtual server.
ACCESS::restrict_irule_events disable
}
when HTTP_REQUEST {
set debug 1
set resource_list_capture 0
if {$debug} { log local0. "Setting resource_list_capture variable to $resource_list_capture" }
if {$debug} { log local0. "HTTP Resquest for: [HTTP::uri] " }
if { [HTTP::path] ends_with "/resource_list.xml" } {
set capture_path [HTTP::path]
if {$debug} { log local0.alert "resource_list.xml request Identified" }
set resource_list_capture 1
if {$debug} { log local0. "Flag to capture resource_list.xml is set: $resource_list_capture" }
}
}
when HTTP_RESPONSE {
if { $resource_list_capture } {
if {$debug} { log local0. "Original request path: $capture_path" }
if {$debug} { log local0. "Capture response for resource_list.xml in HTTP Response: $capture_path" }
} else {
if {$debug} { log local0. "Flag to capture resource_list.xml NOT FOUND during HTTP Response" }
}
}
when HTTP_RESPONSE_DATA {
if { $resource_list_capture } {
if {$debug} { log local0. "Flag to capture resource_list.xml in HTTP Response DATA: $resource_list_capture" }
} else {
if {$debug} { log local0. "Flag to capture resource_list.xml NOT FOUND during HTTP Response Data" }
}
}
Log file output for this rule:
Rule /Common/variable_test.rule : HTTP Resquest for: /vdesk/resource_list.xml
Rule /Common/variable_test.rule : resource_list.xml request Identified
Rule /Common/variable_test.rule : Flag to capture resource_list.xml is set: 1
Rule /Common/variable_test.rule : Setting resource_list_capture variable to 0
Rule /Common/variable_test.rule : HTTP Resquest for: /vdesk/resource_info_v2.xml?prtn=/Common/&na_res=SSLVPN.connect.ap_na_res&rd_res=RDG_Template
Rule /Common/variable_test.rule : Flag to capture resource_list.xml NOT FOUND during HTTP Response