Forum Discussion
redirects with get / post
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?
below is my irule.
when HTTP_REQUEST { if { ([string tolower [HTTP::host]]) contains "unity.mysite.com" } { switch -glob -- [string tolower [HTTP::uri]] { "akcelrons.asmx" { HTTP::redirect "https://webservice.mysite.com/Unity/akcelrons.asmx" } "credispher.asmx" { HTTP::redirect "http://webservice.mysite.com/Unity/credispher.asmx.asmx" } "interfaceser.asmx" { HTTP::redirect "https://webservice.mysite.com/Unity/interfaceser.asmx" } ::"meridian.asmx" { HTTP::redirect "https://webservice.mysite.com/Unity[HTTP::uri]" } "unitysale.asmx" { HTTP::redirect "https://webservice.mysite.com/Unity/unitysale.asmx" } "unitywep.asmx" { HTTP::redirect "https://webservice.mysite.com/Unity/unitysale.asmx" } "weblott.asmx" { HTTP::redirect "https://webservice.mysite.com/Unity/Unityweblott.asmx" } } } }
It get redirected to a GET request
- marco_octavian_Nimbostratus
All,
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...:)
Thank you,
- 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.
- marco_octavian_Nimbostratus
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.
Recent Discussions
Related Content
* 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