Robert_47833
Aug 08, 2011Altostratus
questions on HTTP::header replace Host
Hi,dear irule
I have 2 datacenters,due to some operation,we need to forward traffic on site1 to site2
site1 and site2 have the same domain name www.cjj.com
However ,they can be different in order to achieve goal of forwarding traffic
like www1.cjj.com ,www2.cjj.com(I can change something to achieve this)
for example ,clients visit www.cjj.com and hit site1,when bigip receive this traffic ,forward it to site2 and keep the broswer same as before.
how to achieve this?
I searched the irule here,HTTP::header replace Host are used more often than other methods
But I am confused by events below
when HTTP_REQUEST {
if { [HTTP::header host] eq "www.cjj.com" } {
HTTP::header replace Host "www2.cjj.com" }
}
when HTTP_RESPONSE {
if { [HTTP::header is_redirect]} {
HTTP::header replace Location [string map -nocase {www.cjj.com www2.cjj.com} [HTTP::header value Location]] }
}
Here is my doubts:
1:why should we use HTTP_RESPONSE to change the location?
2:should I set node xxx under HTTP::header replace Host "www2.cjj.com"
like
HTTP::header replace Host "www2.cjj.com"
node xxxxip xxport
3:what is the process of this command ,after excuting this replace,what is the behavior of bigip to handle traffic(I know http::redirect is bigip send 30x to client and the client send request to new URL )
4:how to achieve this goal :forward traffic which hit site1 to site2 ,can I not need two domain name to achieve this?
Thanks in advance