How to replace the hostname from a FQDN in HTTP:HOST

Hi

How is it possible to replace only the hostname within an irule?

Example:

Client requests www.trustme.com so [HTTP:Host] contains this name.

How can I replace only the “www” with “www2” and response

www2.trustme.com to the client?

Many thanx

bb

when HTTP_REQUEST { 
     if { [string tolower [HTTP::host]] eq "www.trustme.com" } { 
          HTTP::redirect "http://www2.trustme.com[HTTP::uri]" } }

That’ll send a redirect to the client for www2.

Hi Chris

I probably did not clear explain what I need.

For example:

we have some domains…

www.test2.com

Now I want to get only the domains to create a new one like:

In case of www.test1.com

mobile.test1.com

In case of www.test2.com

mobile.test2.com

etc…

This should be more dynamically then with a “switch” method:

I think should be something like…

set dom [HTTP:Host]

extract only the domain in this case test1.com build the new FQDN.

I hope I did clearly describe what I mean.

Many thanx

andy

You were there and you didn’t know it! The domain command is your friend: http://devcentral.f5.com/wiki/default.aspx/iRules/domain.html Click Here

So you would want something like this: www2.[domain [HTTP::host] 2]

HTH…Jason

Hi Jason

Thanx for your help…