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

Filter by:
  • Solution
  • Technology

answers

create an httpclass

Updated 1/8/2013 • Originally posted on 08-Jan-2013 by Michelle Johnson 1

i am trying to create an httpclass using tmsh, but am having trouble with the "glob" or "regex" to express a wildcard.

If I was in the GUI, I would create a new HTTPclass, click the checkbox to match on ANY host, then redirect to "www"

 

so, a user who typed   "http://mydomain.com" would get redirected to "http://www.mydomain.com"

 

Here is what I have so far with the tmsh:

 create ltm profile httpclass httpclass_www-redirect hosts add {glob: "*"} ....

 

0
Rate this Question

Answers to this Question

3 Answers:

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER
Updated 08-Jan-2013 • Originally posted on 08-Jan-2013 by GreeceMonkey 109
Hi Michelle,

I have not been doing F5 for long, but I think this is done with an Irule applied to the Virtual Server

when HTTP_REQUEST { 
   if { [HTTP::host] starts_with "http://mydomain.com" } { 
     HTTP::redirect http://www.mydomain.com[HTTP::uri] 
   } 
} 


I dont know how to do this exact syntax with tmsh, but I think to do a redirect you need an Irule and apply this to the VS

Graham
0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER
Updated 10-Jan-2013 • Originally posted on 10-Jan-2013 by What Lies Beneath 6457
I just created one in the GUI and here's how it looks in tmsh;

ltm profile httpclass test {
    app-service none
    cookies none
    defaults-from httpclass
    headers none
    hosts { glob:mydomain.com }
    paths none
    pool none
    redirect www.mydomain.com
}
0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER
Updated 10-Jan-2013 • Originally posted on 10-Jan-2013 by What Lies Beneath 6457
Note, if you wanted to match all hosts it would be 'hosts none' (funnily enough) but you don't want to match www.mydomain.com or your users will be stuck in an endless redirection loop.
0
;