Forum Discussion
Lars_Terje_Vaal
Nimbostratus
Oct 31, 2007HTTP::method. Can it be changed?
Hi. I need to change the http method from POST to GET in a request. Is it possible?
- hoolio
Cirrostratus
I don't think you can set the method with HTTP::method. The wiki page only shows that you can retrieve the method--not set it. If you could change the request method, I'm not sure it would be a good idea. You'd have to try to handle any POST data that was sent with the request.when HTTP_REQUEST { if {$some_condition == 1}{ HTTP::redirect http://[HTTP::host][HTTP::uri] } }
- Patrick_Chang_7Historic F5 AccountYou can do it, but you would have to manually recreate the request in its entirety. This would require parsing the post data and converting them into query parameters in the URI. There is a secret function (not well documented) in the F5 Web Accelerator which will do this for you automatically.
- Lars_Terje_Vaal
Nimbostratus
Interesting, but we do not have the Web Accelerator license.when HTTP_REQUEST { set orginal_request [HTTP::request] } when HTTP_RESPOND { if {some condition} { HTTP::retry $orginal_request } }
- hoolio
Cirrostratus
I don't think there is a way to change the method using HTTP:: commands. I suppose you could collect the TCP data and replace the POST string with GET within the TCP payload. I don't think it would be a simple thing to do though. - hoolio
Cirrostratus
I would think you could modify the variable you're saving the request to, $orginal_request, before using HTTP::retry $orginal_request. - Lars_Terje_Vaal
Nimbostratus
I found the solution now on how to do a HTTP::retry if the request method is POSTwhen HTTP_REQUEST { set orginal_request [HTTP::request] HTTP::collect [HTTP::header "Content-Length"] if {$isRetry} { HTTP::header replace Content-Length "0" HTTP::payload replace 0 0 $payloadReq set isRetry 0 } } when HTTP_REQUEST_DATA { set payloadReq [HTTP::payload] } when HTTP_RESPOND { if {some condition} { HTTP::retry $orginal_request set isRetry 1 } }
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