Forum Discussion

kazeem_yusuf1's avatar
kazeem_yusuf1
Icon for Nimbostratus rankNimbostratus
Sep 19, 2017

IRULES FOR REDIRECTING TRAFFIC BASED ON DYNAMIC CONTENT FOR APPLICATION

I need to redirect traffic for an application, on 10.184.1.191 (VIP) to any of the two servers ,10.184.1.71:9443, or 10.184.1.49:9443. However, the search string is based on paths.

 

HTTP:80 and HTTPS:443, path /oauth2/* => https: 10.184.1.71:9443 & 10.184.1.49:9443 HTTP:80 and HTTPS:443, path /authenticationendpoint/* => https: 10.184.1.71:9443 & 10.184.1.49:9443 HTTP:80 and HTTPS:443, path /wso2/* => https: 10.184.1.71:9443 & 10.184.1.49:9443 HTTP:80 and HTTPS:443, path /services/* => https: 10.184.1.71:9443 & 10.184.1.49:9443.

 

The end servers have dynamic content after the Ip:port combination, example

 

https://10.184.1.71:9443/authenticationendpoint/login.do?client_id=49i1A1Rd6ErNhFtgAuY1b1ybWNsa&commonAuthCallerPath=%2Foauth2%2Fauthorize&forceAuth=false&passiveAuth=false&redirect_uri=http%3A%2F%2F10.184.1.71%3A9086%2Fclm-ui%2F%23%2Fauthcode&response_type=code&scope=openid&state=openid&tenantDomain=carbon.super&sessionDataKey=94da32df-4304-4bd7-a709-07e6eb14f4fb&relyingParty=49i1A1Rd6ErNhFtgAuY1b1ybWNsa&type=oidc&sp=clm-mtnn-phI&isSaaSApp=false&authenticators=IPAuthenticator:LOCAL.

 

How do i write an irule in this case

 

3 Replies

  • Hi Guy,

     

    Do you want just the users to access only those paths and to load balance. Or do you want to do another thing?

     

  • Hello Kazeem,

    Try the following irule on the VS_HTTPS

    when HTTP_REQUEST { 
    
    set path [string tolower [HTTP::path]]
    
     switch -glob $path { 
    
        "/authenticationendpoint/*" -
        "/oauth2/*" -
        "/services/*" - 
        "/wso2/*" { 
            pool pool_name
       }
    
       default {
        log local0. "Fallback for path: $path -- To be defined"
      } 
    
     }
    
    }
    

    Could you clarify if on VS_HTTP you only want to redirect all traffic to HTTPs or only paths that you specified ?

    Regards