Forum Discussion
Glen_Pekarcsik_
Nimbostratus
Apr 04, 2019Using icontrolrest api to configure dos profile in ASM
I am trying to write a icontrolrest API call to configure the dos profile within ASM. When I post the JSON to /mgmt/tm/security/dos/profile it creates the dos profile but I can't find a way to confi...
I assume you have a scenario like this:
GET / HTTP/1.1
Host: somehost.example.com
ABC: abcs_value
And you want to check if there is an ABC header and if so insert a new header named EFG like this:
GET / HTTP/1.1
Host: somehost.example.com
EFG: efg_value
ABC: abc_value
If so, this should work:
when HTTP_REQUEST {
Check if ABC header exists
if {[HTTP::header exists "ABC"]}{
Save the value of ABC
set abc_value [HTTP::header value "ABC"]
Remove the ABC header
HTTP::header remove "ABC"
Insert the EFG header
HTTP::header insert "EFG" value "efg_value"
Insert the ABC header again so it's after the EFG header
HTTP::header insert "ABC" value $abc_value
}
}
Note that I haven't tested it, but it looks about right. If you run into any issues, try adding some logging to the iRule.
Thanks,
Aaron
- Feb 05, 2019