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

Filter by:
  • Solution
  • Technology
Answers

Simple Irule redirect question

Hi,

I am brand new to irules as we are just converting from Cisco ACE.

I want to do a simple re-direct from http > https and add a new URI in the process so :

http://mysite.com to https://mysite.com/something/something

So I need and irule that might look like this ?

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

or something like this ?

when HTTP_REQUEST { HTTP::redirect https://[HTTP::header host]/something/something [HTTP::uri] }

Like I say I am brand new .. so please be gentle.

0
Rate this Question

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

With 11.4.1 TMOS version, you can work with LTM policy.
You will be able to change the URI as you wish and then redirect your user to the newest URL.

If you want to use an iRule here is what you want (again iRule isn't the most optimize method if you have a lot of requests) :

HTTP_REQUEST { 
    HTTP::redirect "https://[getfield [HTTP::host] ":" 1]/something/something/[HTTP::uri]"
}
0
Comments on this Answer
Comment made 24-Sep-2014 by adrian 369
Thanks Thomas, So is the LTM policy a newer method than irules ?
0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Hello Adrian,

You have the perfect example built in already, check in your irule list if you have _sys_https_redirect.

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

next it depends if you wan to keep the uri part from the initial request or or just send the user to /something/something

0
Comments on this Answer
Comment made 24-Sep-2014 by adrian 369
Hi .. I need to retain the hostname and add the something/something onto the return to the client
0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Hi Adrian,

Which version is your BIG-IP running on ? You may not need iRule to do this ;)

0
Comments on this Answer
Comment made 24-Sep-2014 by adrian 369
Hi, We are on 11.4.1 thanks..
0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Yes, LTM policy is a newer and a faster method.
It's available through the webUI so it's easier for guys who don't know iRules yet.

0