Forum Discussion

Luca_55898's avatar
Luca_55898
Icon for Nimbostratus rankNimbostratus
Feb 06, 2012

simple host redirect

This should be easy but for some reason i'm struggling...

 

 

I need to redirect site.com to site.com/portal.

 

 

I thought this would work

 

 

when HTTP_REQUEST {

 

if { [HTTP::host] equals "site.com" }{

 

HTTP::redirect "http://site.com/portal"

 

}

 

}

 

 

But it no work...... What am i missing here?

 

1 Reply

  • this is mine.

    [root@ve1023:Active] config  b virtual bar list
    virtual bar {
       snat automap
       pool foo
       destination 172.28.19.79:80
       ip protocol 6
       rules myrule
       profiles {
          http {}
          tcp {}
       }
    }
    [root@ve1023:Active] config  b rule myrule list
    rule myrule {
       when HTTP_REQUEST {
       if { [HTTP::host] equals "site.com" }{
          HTTP::redirect "http://site.com/portal"
       }
    }
    }
    
    [root@ve1023:Active] config  curl -I http://172.28.19.79 -H "Host: site.com"
    HTTP/1.0 302 Found
    Location: http://site.com/portal
    Server: BigIP
    Connection: Keep-Alive
    Content-Length: 0