Forum Discussion

Ramesh_Babu's avatar
Ramesh_Babu
Icon for Nimbostratus rankNimbostratus
Nov 15, 2019

2 different URI call to same server & different port irule creation

Hi Team,

 

I needs to create irule for the below request, please suggest me how to do,

 

Calls https://i0.test.com should to go real server with http://server01/Base/Arx/

 

Calls https://i0.test.com/Nas should to go real server with http://server01:8080/Nas

5 Replies

  • Hi Ramesh,

    Can you try this?

    when HTTP_REQUEST {
    	if { [HTTP::host] equals "i0.test.com" } {
    		switch -glob [HTTP::uri] {
    			"/" {
    				HTTP::uri "/Base/Arx"
    				node server01-ip 80
    			}
    			"/Nas" {
    				node server01-ip 8080
    			}
    		}
    	}
    }
    • Samir's avatar
      Samir
      Icon for MVP rankMVP

      -glob: allow string pattern matching. It will loop in condition-1, Without glob it will work well.

       

  • Try this irule.. Hope it will help.

    when HTTP_REQUEST {
      if {[HTTP::uri] starts_with "/Nas" } {  
        HTTP::uri "/Nas"    
        node 172.x.x.x 8080 
      } elseif {      
        HTTP::uri “/Base/Arx/"    
        node 172.x.x.x 80   
      } 
    }