Forum Discussion

abdullah_alshah's avatar
abdullah_alshah
Icon for Nimbostratus rankNimbostratus
Oct 12, 2017

multi-able ports and urls

dears please help on below with iRule, I have 5 URLs(ex. sf.stc.com/dd.stc.com/bo.stc.com/tt.stc.com/mm.stc.com) with 5 defrent ports(85.86.87.88.89) and one VS.when I request: sf.stc.com it should redirect me to sf.stc.com:85 dd.stc.com it should redirect me to sf.stc.com:86 bo.stc.com it should redirect me to sf.stc.com:87 tt.stc.com it should redirect me to sf.stc.com:88 mm.stc.com it should redirect me to sf.stc.com:89

 

how I can do that by using iRule?

 

1 Reply

  • Not tested but try this:

    when HTTP_REQUEST {
        if {server_port < 84 || server_port > 84} {
            switch [HTTP::host] {
                "sf.stc.com" {
                    HTTP::redirect "http://[HTTP::host]:85[HTTP::uri]"
                }
                "dd.stc.com" {
                    HTTP::redirect "http://[HTTP::host]:86[HTTP::uri]"
                }
                "bo.stc.com" {
                    HTTP::redirect "http://[HTTP::host]:87[HTTP::uri]"
                }
                "tt.stc.com" {
                    HTTP::redirect "http://[HTTP::host]:88[HTTP::uri]"
                }
                "mm.stc.com" {
                    HTTP::redirect "http://[HTTP::host]:89[HTTP::uri]"
                }
            }
        }
    }