Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Content Rewrite

etherchannel01
Nimbostratus
Nimbostratus

I have been using the content rewrite profile to rewrite requests from our externally available URL to the servername:port of the back end pool member. Everything has been working great with that config but I need to be able to use it when there is more than one member in the pool. For example, if a request is load balanced to server1 I need the content rewrite profile to do a rewrite to the servername:port, if it goes to memberserver2 then I need it to the same thing for that server. Is there a way to do that with the content rewrite profile or is there an iRule that can statisfiy this? 

 

Thanks!

1 REPLY 1

Hi @etherchannel01 , 
I have deployed this iRule to simulate your scenario of URL rewriting : 

when HTTP_REQUEST { 
    if { [HTTP::host] equals "shopping.asm.f5"  } { 
        HTTP::header replace Host [LB::server addr]:[LB::server port] 
        }
    }

and I got this Result on my lab : 
sample.PNG

you can see the host has been changed to the selected pool member and port. 

> in your scenario you want the pool member-name:port , not pool member ip address:port 
so try to use 

 [LB::server name]:[LB::server port] (instead of)  [LB::server addr]:[LB::server port]

There are a lot of options with  [LB::server] function 


> may my iRule meets your Concern or give you a clue to find the optimal solution , I test it on my lab and it has given me the expected result accourding my lab scenario. 

> If this available with you , I want to see how do you configure the Content rewrite profile , it just for adding to my knowledge. 


_______________________
Regards
Mohamed Kansoh