For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Ale66's avatar
Ale66
Icon for Nimbostratus rankNimbostratus
May 11, 2010

Rewrite rule to single file

Hi all,

 

this is what we have to do:

 

 

typing http://www.aaa.com/xxx

 

you must be redirect to

 

http://www.bbb.com/yyy/file.html

 

but the final domain must be rewritten in order to obtain

 

http://www.aaa.com/yyy/file.html. (file.html is not a default for the destination http server)

 

 

We configured iRules with the external pool (www.bbb.com is an external domain)

 

 

The question is: is it possible to do this pointing at a single file?

 

 

Thanks in advance

 

 

frafra

 

 

P.S.

 

FYI

 

F5 10.1.0 Build 3372.0

 

ProxyPass iRule, Version 10.2

 

 

 

 

2 Replies

  • Hi FraFra,

    If you are doing a redirect based on the incoming URL, then you can pretty much tell it explicitly to do anything that you want.

    In this case your flipping the [HTTP::host] from aaa.com to bbb.com, and replacing the [HTTP::uri] /xxx with /yyy/file.html (which are all fine to do in a redirect). As long as you know the explicitly translation you can do this:

     when HTTP_REQUEST { if { [HTTP::host] equals "www.aaa.com" and [HTTP::uri] contains "/xxx" } { HTTP::redirect "http://bbb.com/yyy/file.html" } } 

    If you want to be more dynamic let me know and I can work with you to get you what you need.

    If you have need of it, then this is an iRule that will just flip the Domain Name:

    In your case it would do this (keeping the URI intact):

    http://www.aaa.com/xxx

    to

    http://www.bbb.com/xxx

     when HTTP_REQUEST { if {[string tolower [HTTP::host]] contains "www.aaa.com"}{ set host [string map -nocase {www.aaa.com www.bbb.com} [HTTP::host]] HTTP::redirect "http://$host[HTTP::uri]" } } 
  • Ale66's avatar
    Ale66
    Icon for Nimbostratus rankNimbostratus
    Excuse me if I answer only today.

     

    Thanx a lot for your suggestion.

     

    In very late

     

     

    frafra