Forum Discussion
FSC-IT_27241
Nimbostratus
Oct 19, 2015How to change a put into a post
Let me start by saying I am in over my head. But due to various reasons for a quick workaround my dev team has asked me if there is a way to turn a put command into a post command using an irule. ...
Brad_Parker
Cirrus
Oct 19, 2015You will have to do something like this similar to this post, https://devcentral.f5.com/questions/irule-to-change-http-get-into-post:
when CLIENT_ACCEPTED {
TCP::collect
}
when CLIENT_DATA {
separate uri and query string
set uri [findstr [TCP::payload] "PUT " 4 " HTTP/1."]
switch -glob $uri {
"/data/rest/abc/list/shared/*" -
"/data/rest/abc/list/tag/*" -
"/data/rest/abc/group/*" {
set uri_no_query [findstr $uri "" 0 "?"]
set query [findstr $uri "?" 1]
replace TCP payload
regsub -all -nocase "PUT" [TCP::payload] "POST" newdata
set newdata1 [string map "$uri $uri_no_query" $newdata]
regsub -all -nocase "Accept: " $newdata1 "Content-Type: application/x-www-form-urlencoded\r\nContent-Length: [string length $query]\r\nAccept: " newdata2
TCP::payload replace 0 [TCP::payload length] ${newdata2}$query
}
}
TCP::release
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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