Forum Discussion

Robert_Pagano_7's avatar
Robert_Pagano_7
Icon for Nimbostratus rankNimbostratus
Dec 29, 2005

best way to move redirect function from Linux/Apache server to BIG-IP LTM?

I am trying to use a BIG-IP LTM box to replicate the functionality currently provided by a Linux/Apache server which is virtual hosting a number of domains.

 

 

The Linux/Apache server is basically just acting as a "redirect server" for a number of our domains. If a user, for example, types "www.somedomain.com" into their browser, the request is handled by the server (using the Apache "rewrite engine") such that the client is redirected to "somedomain.com." The server handles approximately twenty domains in this fashion.

 

 

I have configured an "HTTP redirect" rule on the BIG-IP before and it works fine; but it is a simple "one-for-one" redirect (one virtual IP, one URL) and just redirects clients to use https rather than http. The Linux/Apache environment is a "one-to-many" (one IP, many URLs) arrangement and redirects clients to different hostnames.

 

 

I would imagine that the F5 can somehow replicate the Linux/Apache virtual hosting and redirect functionalities but I am not sure about the best way to implement it (multiple "if" statements in an HTTP redirect rule?).

 

 

I am concerned about the scalability and performance impact of any such implementation.

 

 

The BIG-IP box in question is a model 2400 -- operating in "one-arm mode" -- and is running "4.5PTF-07 Build18" code.

 

 

FYI, here is a (slightly modified) snippet of the Linux/Apache box's httpd.conf file...

 

 

------------------

 

NameVirtualHost AAA.BBB.CCC.248

 

 

============ Default Action ======================

 

 

ServerAdmin techcontact@bogus.domain.com

 

ServerName AAA.BBB.CCC.248

 

ServerAlias AAA.BBB.CCC.248

 

RewriteEngine On

 

RewriteRule ^/(.*) http://bogus.domain.com

 

 

==================================================================

 

 

ServerAdmin techcontact@bogus.domain.com

 

ServerName www.bogus.domain.com

 

ServerAlias www.bogus.domain.com

 

RewriteEngine On

 

RewriteRule ^/(.*) http://bogus.domain.com/$1

 

 

==================================================================

 

 

ServerAdmin techcontact@bogus.domain.com

 

ServerName www.anotherbogus.domain.com

 

ServerAlias www.anotherbogus.domain.com

 

RewriteEngine On

 

RewriteRule ^/(.*) http://anotherbogus.domain.com/$1

 

 

------------------

 

 

Any assistance will be greatly appreciated.

 

 

Thank you.

 

  • Thanks for the reply.

     

     

    So... if I have twenty domains named, for example,

     

     

    domain-01.com

     

    domain-02.com

     

    ...

     

    domain-20.com

     

     

    (where all of them resolve to the same virtual IP address on the BIG-IP)

     

     

    and I wanted to redirect clients as follows

     

     

    www.domain-01.com ---> domain-01.com

     

    www.domain-02.com ---> some-other-domain.com

     

    ...

     

    www.domain-20.com ---> yet-another-domain.com

     

     

    would I do something like the following?

     

     

    if (http_host contains "www.domain-01.com") {redirect to "http://domain-01.com/"}

     

    if (http_host contains "www.domain-02.com") {redirect to "http://some-other-domain.com/"}

     

    ...

     

    if (http_host contains "www.domain-20.com") {redirect to "http://yet-another-domain.com/"}

     

     

    --

     

    Rob

     

     

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    Yes, that's the kind of syntax you'd use. Though I'd recommend using elseif statements after the first if. This way the rule won't keep evaluating all the statements after it finds a match.

     

     

    -Colin