Forum Discussion

CHRISTY_THOMAS's avatar
Jun 15, 2024

Dynamic url redirection feasibility

In one of the BIG –IP integrated application need to redirect a dynamic url to other one.

 

Requirement description:

“”

Client require the call back API to FED bank endpoint in format : IP:port/udir/RespChkTxn/…..  . Since we are using the IBM’s product we will have our url in format https://apiuatgwy.fedbank.com/fed/uat/udir/RespChkTxn/ . client at their end cannot append /fed/uat since this is uniform format across call banks. Hence kindly check if the url redirect may be possible before it reaches gateway.

 

Original url by npci example:

https://apiuatgwy.febbank.com/udir/RespChkTxn/1.0/urn:txnid:SIBJfYoPALjqHtdLbdDbLbp1YEQ7DZFV5LR

url to be redirected :

https://apiuatgwy.fedbank.com/fed/uat/udir/RespChkTxn/1.0/urn:txnid:SIBJfYoPALjqHtdLbdDbLbp1YEQ7DZFV5LR

 

“”

 

  1. Whether it is possible to redirect/rewrite dynamic url’s in BiG-IP?
  2. Share the irule/redirect/rewrite etc. configuration for achieving the above requirement

 

Regards

Christy Thomas

  • Paulius's avatar
    Paulius
    Jun 19, 2024

    Based on what you provided in your screenshot it should be the following.

    when HTTP_REQUEST priority 500 {
    
        if { [HTTP::host] eq "apiuatgwy.fedbank.com" } {
    
            if { [HTTP::uri] starts_with "/udir" } {
                set URI [string map -nocase {"/udir" "/sib/uat/udir/"} [HTTP::uri]]
                HTTP::uri ${URI}
            }
    
        }
    
    }

     

5 Replies

  • Assuming that you don't really have to pay any mind to the piece following this path "/udir/RespChkTxn/1.0/urn" because the remainder is dynamic the following should work. If you wish to have to have another redirect other than 302 then you could use HTTP::respond with the appropriate HTTP status value.

    when HTTP_REQUEST priority 500 {
    
        set URI [string tolower [HTTP::uri]]
    
        if { [HTTP::host] eq "apiuatgwy.fedbank.com" } {
    
            if { ${URI} starts_with "/udir/respchktxn/1.0/urn" } {
                HTTP::redirect "https://[HTTP::host]/fed/uat[HTTP::uri]"
            }
    
        }
    
    }

     

  • Hi Paulius 

    Unfortunately the irule that you have shared is not working. I have attached a picture that, the same scenario has worked in cloudflare, Requestig you to check the attachment and help on this.

     

    thanks

    Christy 

    • Paulius's avatar
      Paulius
      Icon for MVP rankMVP

      Based on what you provided in your screenshot it should be the following.

      when HTTP_REQUEST priority 500 {
      
          if { [HTTP::host] eq "apiuatgwy.fedbank.com" } {
      
              if { [HTTP::uri] starts_with "/udir" } {
                  set URI [string map -nocase {"/udir" "/sib/uat/udir/"} [HTTP::uri]]
                  HTTP::uri ${URI}
              }
      
          }
      
      }

       

  • is that callbak url parameter is part of client request parameter/body?

    if yes, you need to modify the intended object.