Forum Discussion
nitass
Jan 27, 2013Employee
Ex. www.mysite.com/partner -> will go to PARTNER_POOL but the browser will just show www.mysite.com
when HTTP_REQUEST {
if { not ([HTTP::uri] starts_with "/partner") } {
HTTP::uri /reseller[HTTP::uri]
} {pool PARTNER_POOL}
}i think the example and irule you gave are not consonant, aren't they??
Will this be in the HTTP_REPONSE section, verify that it is a redirect, retrieve the "Location" header, and modify the contents of the "Location" header to be correct for your application?e.g.
[root@ve10:Active] config b virtual bar list
virtual bar {
snat automap
pool foo
destination 172.28.19.252:80
ip protocol 6
rules myrule
profiles {
http {}
tcp {}
}
}
[root@ve10:Active] config b pool foo list
pool foo {
members 200.200.200.101:80 {}
}
[root@ve10:Active] config b rule myrule list
rule myrule {
when HTTP_REQUEST {
HTTP::uri [string map {/partner /reseller} [HTTP::uri]]
}
when HTTP_RESPONSE {
if { [HTTP::is_redirect] } {
HTTP::header replace Location [string map {/reseller /partner} [HTTP::header Location]]
}
}
}
[root@ve10:Active] config ssldump -Aed -nni 0.0 port 80
New TCP connection 1: 172.28.19.251(47790) <-> 172.28.19.252(80)
1359307811.9323 (0.0010) C>S
---------------------------------------------------------------
HEAD /partner/something HTTP/1.1
User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
Accept: */*
Host: www.test.com
---------------------------------------------------------------
New TCP connection 2: 200.200.200.253(47790) <-> 200.200.200.101(80)
1359307811.9341 (0.0017) C>S
---------------------------------------------------------------
HEAD /reseller/something HTTP/1.1
User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
Accept: */*
Host: www.test.com
---------------------------------------------------------------
1359307811.9352 (0.0010) S>C
---------------------------------------------------------------
HTTP/1.1 302 Found
Date: Sun, 27 Jan 2013 17:55:49 GMT
Server: Apache/2.2.3 (CentOS)
Location: http://www.test.com/reseller/somethingelse
Content-Type: text/html; charset=iso-8859-1
---------------------------------------------------------------
1359307811.9353 (0.0029) S>C
---------------------------------------------------------------
HTTP/1.1 302 Found
Date: Sun, 27 Jan 2013 17:55:49 GMT
Server: Apache/2.2.3 (CentOS)
Location: http://www.test.com/partner/somethingelse
Content-Type: text/html; charset=iso-8859-1
---------------------------------------------------------------