John_Ogle_45372
Jan 25, 2010Nimbostratus
URL rewrite (multiple)
I have three virtuals (SAP implmenetation) that need URL rewriting both ways. The client hits app1.company.com/index.html. When it gets passed to a pool member (server), the host field needs to be rewritten to read "server1.company.com". On the responses,the reverse needs to happen. My two questions are:
1) Does the following irule look sufficient?
2) Is there a better way to do this? Data group? etc.????
Thank you,
when HTTP_REQUEST {
if { ( [HTTP::host] equals "app1.company.com" ) } {
HTTP::header replace Host "server1.hostname.company.com"
}
if { ( [HTTP::host] equals "app2.company.com" ) } {
HTTP::header replace Host "server2.hostname.company.com"
}
if { ( [HTTP::host] equals "app3.company.com" ) } {
HTTP::header replace Host "server3.hostname.company.com"
}
}
when HTTP_RESPONSE {
if { ( [HTTP::host] equals "server1.hostname.company.com" ) } {
HTTP::header replace Host "app1.company.com"
}
if { ( [HTTP::host] equals "server2.hostname.company.com" ) } {
HTTP::header replace Host "app2.company.com"
}
if { ( [HTTP::host] equals "server3.hostname.company.com" ) } {
HTTP::header replace Host "app3.company.com"
}
}