Forum Discussion
AN_168028
Nimbostratus
May 31, 2018iRULE to extract domain info from HORIZON VDI BROKER XML
I am surprised.. no one came across with this.. I am trying to read xml broker for Horizon VDI.. and get domain info out of it and redirect based on domain... Following iRULE I have Code
...
Jun 01, 2018
Try adding some logging to the iRule to see if the URI, METHOD and Content-Length matches. I tested your iRule and in my lab it triggers the HTTP_REQUEST_DATA event.
when HTTP_REQUEST {
log local0. "uri: [HTTP::uri]"
log local0. "method: [HTTP::method]"
log local0. "content-length: [HTTP::header Content-Length]"
if { ( [HTTP::uri] contains "/broker/xml") and ( [HTTP::method] eq "POST")and ([HTTP::header Content-Length] == 395)} {
HTTP::collect [HTTP::header Content-Length]
}
}
when HTTP_REQUEST_DATA {
log local0. "HTTP_REQUEST_DATA triggered"
Parse XML Data
set xmlusername [findstr [HTTP::payload] "username" 22 ""]
set xmldomain [findstr [HTTP::payload] "domain" 22 ""]
log local0. "xmlusername check" $xmlusername
if {($xmlusername contains "user1")} {
HTTP::redirect https://vdi1.abc.com
}
}
Output:
Jun 1 14:28:54 nielsvs-bigip info tmm[13519]: Rule /Common/IRULE_XML : uri: /broker/xml
Jun 1 14:28:54 nielsvs-bigip info tmm[13519]: Rule /Common/IRULE_XML : method: POST
Jun 1 14:28:54 nielsvs-bigip info tmm[13519]: Rule /Common/IRULE_XML : content-length: 395
Jun 1 14:28:54 nielsvs-bigip info tmm[13519]: Rule /Common/IRULE_XML : HTTP_REQUEST_DATA triggered
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects