Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Answers

Irule to Redirect from https://abc.com/test/foo?app=$1&ver=$2&cal=$3 to https://abc.com/bar.?$1.$2.$3

Hello, Is below redirection possible using irules. If yes, can you please help.

The incoming URI that client requests: /test/foo?app=$1&ver=$2&cal=$3

Redirects to: /bar.?$1.$2.$3.

-->The $1, $2 , $3 are the variables in the request and keeps on changing with every request.

For example if in the browser, the URL is https://abc.com/test/foo?app=$1&ver=$2&cal=$3 , it the client should get 301 redirect to https://abc.com/bar.?$1.$2.$3.

Thank you

0
Rate this Question

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

You can use following code to get query string parameters values

set ver [URI::query [HTTP::uri] ver]        
set cal [URI::query [HTTP::uri] cal]    
set app [URI::query [HTTP::uri] app]
0
Comments on this Answer
Comment made 2 days ago by brook8 1

works great when i try from the browser, but responds weird if i try to cURL the URI

0
Comment made 2 days ago by Stanislas Piron 9518

with curl, don't forget to set URL between simple quote!!!

curl 'https://abc.com/test/foo?app=$1&ver=$2&cal=$3'

if you don't use it, & character is evaluated as bash operator

0