Forum Discussion

Yazan_Khader's avatar
Yazan_Khader
Icon for Nimbostratus rankNimbostratus
Nov 24, 2013

URI and Host replace

hi ,

 

I need to do the following :

 

when user request : https://a.x.com/retail

 

F5 will change it to : http://b.x.com:9081/portal when forwarding the request to the pool-A, and will return https://a.x.com/retail with uri mask

 

when user request : https://a.x.com/corporate

 

F5 will change it to : http://b.x.com:9082/portal when forwarding the request to the pool-B , and will return https://a.x.com/retail with uri mask

 

  • the server can accept b.x.com in the host header
  • two pools were configured , pool-A [member is b.x.com port 9081] , pool-B [member is b.x.com port 9082]

     

  • please can you help me to configure an iRule meeting my requirements .

     

thanks Yazan Khader

 

5 Replies

  • adding more details :

     

    hi ,

     

    I need to do the following :

     

    when user request : https://a.x.com/retail F5 will change it to : http://b.x.com:9081/portal when forwarding the request to the pool-A, and will return https://a.x.com/retail with uri mask to the client

     

    when user request : https://a.x.com/corporate F5 will change it to : http://b.x.com:9082/portal when forwarding the request to the pool-B , and will return https://a.x.com/retail with uri mask to the client ◾the server can accept b.x.com in the host header ◾ two pools were configured , pool-A [member is b.x.com port 9081] , pool-B [member is b.x.com port 9082]

     

    ◾ please can you help me to configure an iRule meeting my requirements .

     

    thanks Yazan Khader

     

    .

     

  • Try this:

    when HTTP_REQUEST {
        switch -glob [string tolower [HTTP::uri]] {
            "/retail*" {
                pool Pool-A
                HTTP::header replace Host "b.x.com:9081"
                HTTP::uri "/portal"
            }
            "/corporate*" {
                pool Pool-B
                HTTP::header replace Host "b.x.com:9082"
                HTTP::uri "/portal"
            }
            default {
                reject
            }
        }
    }
    
  • thank you Kevin , this will work for the client request the server will respond back to the client with x.b.com:port and uri /portal/* which need to be mapped back to host a.x.com and uri [/retail/* or /corporate/*] based on the original request .

     

    also , on the user's browser address bar , I need to hide the mapped uri path after /retail and /corporate [/retail/xxxxx] and [/corporate/xxxxx]

     

    please can you help me with this

     

  • Well, assuming the references to "/retail" and "/corporate" are going to be within the payload (ie. page object references), I might suggest a ProxyPass iRule implementation, or the rewrite profile if your on 11.4.

     

  • thanks Kevin ,

     

    I tried the ProxyPass irule with the following data group settings but didn't work:

     

    "a.x.com" := "b.x.com", "a.x.com/retail" := "b.x.com:9081/iportal pool-A", "a.x.com/corporate" := "b.x.com:9082/iportal pool-B", "https://" :- "http://" "/" := "b.x.com/",

     

    i noticed that the depending on the previous data-group values . the client browser is redirected to a.x.com/iportal then I got http-error-500