Forum Discussion

Blake_Traister2's avatar
Blake_Traister2
Icon for Nimbostratus rankNimbostratus
Oct 04, 2010

Rewrite URL and keep with POST method

Hey all

 

 

So I have read in earnest peoples struggles with POST methods. I have a similar issue.

 

 

I am using an iRule to parse out the URIs that comeinto the vip. Anything that matches (example) pookie needs to have its URL rewritten and resubmitted using the POST method.

 

 

Redirects are changing the POST to GET which is causing problems.

 

 

I decided to not worry about URL rewriting and just started pointing the traffic to a different pool:

 

 

when HTTP_REQUEST {

 

if { [HTTP::uri] starts_with "/pookie" } {

 

pool dev-adchat_5280

 

}

 

}

 

 

it is difficult for me to see if this is working properly. There is another irule that adds HTTP headers and im concerned thats altering the POST method also.

 

 

Any thoughts are greatly appreciated.

 

  • Hey Blake,

     

     

    I suspect that this is related to the general problems with User-Agents processing 301 and 302 statuses for POST requests. The expected behavior can be found in RFC 2616 ( http://datatracker.ietf.org/doc/rfc2616/ ) Sections 10.3.2 and 10.3.3. To quote:

     

     

    10.3.2

     

    "If the 301 status code is received in response to a request other than GET or HEAD, the user agent MUST NOT automatically redirect the request unless it can be confirmed by the user, since this might change the conditions under which the request was issued.

     

     

    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"

     

     

    What is the redirect for? (i.e. HTTP to HTTPS?) In some cases it may actually be better to use a stream profile to rewrite the page content as it is delivered to the user-agent so that a redirect is no longer actually required.

     

     

    Cheers!

     

     

    // Ben

     

  • If rewriting the response which prompts the user to send the POST request isn't possible, you could try an option Nat came up with here:

     

     

    http://devcentral.f5.com/Forums/tabid/1082223/asg/50/showtab/groupforums/aff/5/aft/1172096/afv/topic/Default.aspx

     

     

    Aaron