We have created iRules to perform redirects on existing web services. All the rules appear to work correctly when performing a HTTPGet. However, when connecting from another application, the request comes across as an HTTPPost and is never redirected. I have verfied in the IIS logs that the request is never sent to its final destination (the server trying to redirect to). Is this something that can be fixed on the iRule, profile or the vip?
If you look through the IIS logs there will most likely be a get request. When a POST request get a redirect it will be retried as a get request. you can use the following iRule to force the browser to send the request to the correct location
Please explain in more detail. If i already have the iRule from above where would I place HTTP_POST_redirectNew118.ashx. So how and where would I use your example?
the basic issue is that you can’t redirect (HTTP 3xx) a POST request, that is simply how redirects were designed.
the iRule that Richard mentions uses a trick to still be able to get the POST data through. it builds a piece of javascript that will take the information from the POST and send it again when the page loads.
if you want to include this into your code you could include the HTTP_REQUEST section completely. add a HTTP_REQUEST_DATA section and build a similar switch statement for the different POST urls based on URI.
Not to throw the conversation into a tangent, but are you certain that the iRule works with GET requests? You’re using a glob switch but no glob patterns, so not sure where the matches are being made. Here’s a slightly modified version of your iRule:
First, thank you all for your help, Still having trouble understanding. Below is the exact irule from the LTM, other comments are from the Web Developer. Im in the middle F5 Admin and the HTTP Developer says it fails the Post. So help me to bridge the gap. Lets startover.. Kevin, let me give you the current iRule, below. Richard, Boneyard, are your comments for me of http developer?
The iRule was for the f5. The browser sending the post request will not resend the post request to the 302, it mite work if you send it a 307 that depends on the browser but it open up a security risk. The iRule in question will cause the browser to run some Javascript to redirect to the post to the correct location.
Ok guys, so I have my original iRule and sample link from Richard. Now how in the heck to I merge these irule. Im not at the admin level need to script this, so I f you could help please.
as i posted earlier: if you want to include this (get into put irule) into your code you could include the HTTP_REQUEST section completely. add a HTTP_REQUEST_DATA section and build a similar switch statement for the different POST urls based on URI. just start with something simple and expand on it. please remember everyone here is answering in their spare time, cant expect them to do all the work for you. also try to format your posts, like they are now makes it really hard to read.
I trying to work on it and so are our developers. But we are having a problem understanding. Even if you could help with a sample. So I have the first part is by iRule and second part is your recommendation. We are havinging problems adding our current irule to your sample.
I am looking at this iRule and I have a few questions. Boneyard stated to build a similar switch statement for the different POST urls based on URI but is this really necessary? Won’t it work as is for all the URL/uri combos listed?
If I hit a site and requires the inputting of three pieces of data: UserName Password EmployeeID
Based on Nitass’ example, won’t it grab all three pieces of data automatically. If not, can you show a modification of the script to do just that? Please forgive my ignorance and educate me a bit, please…
you might get confused because of the up vote of nitas last reply, which made it show up first, my comments were on the original question. nitas upvoted reply does the trick.
Got it. Makes sense Basically the last post by Nitass does the trick. My only concern is that this script still wouldn’t be the most efficient if there were many fields. If there are many fields of input, I work with the web developers and architect a different solution. Just my two cents. Any feedback is always appreciated.
it might work if there is full uniformity in the post URL then it might work without switch, but in this case the number of switch statements are required i believe.