Forum Discussion

jafar_39850's avatar
jafar_39850
Icon for Nimbostratus rankNimbostratus
Jun 16, 2008

HTTP - HTTPS Redirection POST Content

OK, http to https redirection for our site works.

 

Here's the iRule code:

 

when HTTP_REQUEST { 
 HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri] 
 }

 

 

Now, due to some old legacy site that we need to maintain, we ran into a bit of a problem.

 

The site would receive POST values from a URL site, but seems like in the transition from http to https, the POST values were lost. Example: I created a HTML page with this in:

 

 

 action="http://testsite/printPost.php" method="post"> 
      
      
 

 

 

The printPost.php would just print out the value of the text box.

 

If I point my host file directly to the server, it works. POST value is displayed properly.

 

If I point it to F5, the site gets redirected to HTTPS but the POST value is missing.

 

Help?

 

2 Replies

  • Unfortunately that's correct, the POST gets lost when being redirected. That's the correct behavior of the HTTP protocol and your browser.

     

     

    You've got two options:

     

    - Bypass the redirection when a POST is detected

     

    - Store the POST request, and insert it on the new request. It can be tricky, but we can try.

     

     

    I'd be glad to help you on this issue if you want.

     

     

    Regards.
  • mgabaldon is correct in that the browser will send a GET request to the new location--not a POST.

     

     

    Another option would be to rewrite the form action on the previous response to https://testsite/printPost.php. This could potentially be done on the application or if the traffic is going through the LTM you could use a stream profile and STREAM:: commands.

     

     

    If rewriting the form action isn't possible, you could also try parsing the POST parameters and rewriting the 302 redirect's Location value to include them as URI parameters. If the application accepts the parameters in the URI this could work.

     

     

    Aaron