Forum Discussion
iRule question?
I'm trying to write an iRule that take a shorter URL and expand it while adding the last 9 characters to the end of it.
So as an example when someone browses to:
http://website.ca/admn/012345678
Note: The last 9 characters (in this example= 012345678) are variable and always different depending on the user.
I then want the URL to redirect to this longer URL while adding the variable 9 characters to the end of the URL after ID=
https://website.ca/AppXtender/ISubmitQuery.aspx?DataSource=BPROD&appname=B-S-ADMN&ID=012345678
I've been trying to tweak the following iRule without success as I'm unsure what I should be putting into "string range", does anyone have any suggestions?
when HTTP_REQUEST { set uri [HTTP::uri] switch -glob [string tolower [HTTP::uri] ] { "/admn/*" { HTTP::uri "/AppXtender/ISubmitQuery.aspx?DataSource=BPROD&appname=UM-S-ADMN&ID=[string range $uri 5 end]" } } }
2 Replies
Hello,
Maybe an irule that the below one can fit your needs :
when HTTP_REQUEST { set uri [HTTP::uri] switch -glob [string tolower [HTTP::uri] ] { "/admn/" { HTTP::uri "/AppXtender/ISubmitQuery.aspx?DataSource=BPROD&appname=UM-S-ADMN&ID=[getfield [HTTP::path] \"/\" 2]" } } }- Stefan_Klotz
Cumulonimbus
Hi Perch,
I would try it with this one:
when HTTP_REQUEST { option1 set user_id [findstr [HTTP::uri] "/admn/" 6] option2 set user_id [getfield [HTTP::uri] "/" 3] HTTP::respond 301 Location "https://website.ca/AppXtender/ISubmitQuery.aspx?DataSource=BPROD&appname=UM-S-ADMN&ID=$user_id" }Ciao Stefan 🙂
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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