Lark_53475
Jun 14, 2007Nimbostratus
HTTP Post Redirect getting changed to a GET...
Thanks for everyone's input, as I am very new to iRules. I have a need to redirect a request from http://server:2210 to https://server:2211. I am able to achieve this with the a simple rule:
HTTP::redirect "https://fstestora.hiw.com:2211[HTTP::uri]"
What I'm running into is that we have a custom client application that is doing a POST with xml data. When the POST hits the F5, it receives the redirect and response code, however the client resubmitts the request to the new location as a GET. The full rule I am using is:
when HTTP_REQUEST {
if {[HTTP::uri] contains "/xmllink"} {
HTTP::respond 307 Location "https://server.domain.com:2211[HTTP::uri]" replace HOST "server.domain.com:2211" "[HTTP::host][HTTP::uri]"
}
else{
HTTP::redirect "https://server.domain.com:2211[HTTP::uri]"
}
}
I've tried to change the HTTP Response to 301 and 302 as well with no difference. Reading the RFC on redirection, I see the following notation:
"Note: When automatically redirecting a POST request after receiving a 301 status code, some existing HTTP/1.0 user agents will erroneously change it into a GET request."
I believe I am running into this situation. Hope that explanation makes sense. Does anyone have any suggestions on how to address this situation using an iRule? I have not ruled out that this is just a function of the user agent/application and that there is no way to do this without simply getting the application to update it's URL. Thanks!