Forum Discussion

bassem_8348's avatar
bassem_8348
Icon for Nimbostratus rankNimbostratus
Sep 01, 2012

Redirect all ports except http and https

Hi

 

am trying to redirect all targeted ports except http and https to the node ip

 

if the target http://1.1.1.1:5050 it should be redirected to 10.10.10.1:5050

 

 

But i have dozen of ports so i just need to redirect all ports except http and https , also how can i redirect subdirectory to another ip and port

 

 

http://x.com/test it should be redirect to 10.10.10.1:2020

 

 

 

Thanks in advance

 

1 Reply

  • not sure if i understand correctly. anyway, hope it helps.

    e.g.

    [root@ve10:Active] config  b virtual bar list
    virtual bar {
       translate service enable
       snat automap
       pool foo
       destination 172.28.19.79:any
       ip protocol 6
       rules myrule
       profiles {
          clientssl {
             clientside
          }
          http {}
          tcp {}
       }
    }
    [root@ve10:Active] config  b pool foo list
    pool foo {
       members 200.200.200.101:80 {}
    }
    [root@ve10:Active] config  b rule myrule list
    rule myrule {
       when CLIENT_ACCEPTED {
       SSL::disable clientside
       switch [TCP::local_port] {
          80 { }
          443 { SSL::enable clientside }
          default {
             node 200.200.200.102 [TCP::local_port]
          }
       }
    }
    
    when HTTP_REQUEST {
       set uri [HTTP::uri]
       if {[string tolower $uri] equals "/test"} {
          node 200.200.200.111 2020
       }
    }
    
    when SERVER_CONNECTED {
            log local0. "source [IP::client_addr]:[TCP::client_port] | destination [clientside {IP::local_addr}]:[clientside {TCP::local_port}] | server [IP::remote_addr]:[TCP::remote_port] | uri $uri"
    }
    }
    
    [root@ve10:Active] config  tail -f /var/log/ltm
    Sep  2 16:25:53 local/tmm info tmm[4925]: Rule myrule : source 172.28.19.251:45759 | destination 172.28.19.79:80 | server 200.200.200.101:80 | uri /something
    Sep  2 16:26:01 local/tmm info tmm[4925]: Rule myrule : source 172.28.19.251:41619 | destination 172.28.19.79:443 | server 200.200.200.101:80 | uri /something
    Sep  2 16:26:15 local/tmm info tmm[4925]: Rule myrule : source 172.28.19.251:51055 | destination 172.28.19.79:5050 | server 200.200.200.102:5050 | uri /something
    Sep  2 16:26:27 local/tmm info tmm[4925]: Rule myrule : source 172.28.19.251:45762 | destination 172.28.19.79:80 | server 200.200.200.111:2020 | uri /test