Forum Discussion
Michelle_Johns1
Nimbostratus
Jan 08, 2013create an httpclass
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: "*"} ....
3 Replies
- Approxee
Nimbostratus
Hi Michelle,
I have not been doing F5 for long, but I think this is done with an Irule applied to the Virtual Serverwhen 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 - What_Lies_Bene1
Cirrostratus
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 } - What_Lies_Bene1
Cirrostratus
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.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects