Forum Discussion

ppater_73099's avatar
ppater_73099
Icon for Nimbostratus rankNimbostratus
Jul 08, 2013

URL forward

Hello,

 

Can someone help me with creating an irule?

 

I want to foward the following.

 

http://www.example.com/test1

 

to

 

http://test1.example.com

 

 

Thanks

 

Best Regards

 

Patrick

 

4 Replies

  • do you want redirection or rewriting?

     

     

    Redirects, Rewrites and App Transfers via iRules by Colin Walker

     

    https://devcentral.f5.com/tech-tips/articles/redirects-rewrites-and-app-transfers-via-irules
  • e.g.

    [root@ve10:Active] config  b virtual bar list
    virtual bar {
       snat automap
       destination 172.28.19.252:80
       ip protocol 6
       rules myrule
       profiles {
          http {}
          tcp {}
       }
    }
    [root@ve10:Active] config  b rule myrule list
    rule myrule {
       when HTTP_REQUEST {
      if { [HTTP::host] eq "www.example.com" and [HTTP::uri] eq "/test1" } {
        HTTP::redirect "http://test1.example.com"
      }
    }
    }
    
    [root@ve10:Active] config  curl -i http://www.example.com/test1
    HTTP/1.0 302 Found
    Location: http://test1.example.com
    Server: BigIP
    Connection: Keep-Alive
    Content-Length: 0