Marek_George
Jul 23, 2010Nimbostratus
prefix based pool selection with content rewriting
Hi,
I use one virtual server and several backend systems (pools). The requested uri contains a prefix,
that me allow to set the right pool when the request was send to bigip. For further requests I must
rewrite the content from the specific backend system and insert the prefix.
Something going wrong!
Requests and responses are not rewritten correctly. The bigip mixed requests and responses.
Example: Requested was "/GSRV-SRV1" and the response was processed for "/GSRV-SRV2".
Where is the problem?
Version: BIG-IP 9.3.1 Build 81.1
when HTTP_REQUEST {
set SRVResponse ""
switch -glob [string toupper [HTTP::uri]] {
"/GSRV-SRV1*" {
discard the prefix
HTTP::uri [string range [HTTP::uri] 10 end]
set SRVResponse "/GSRV-SRV1"
pool myServer1
}
"/GSRV-SRV2*" {
HTTP::uri [string range [HTTP::uri] 10 end]
set SRVResponse "/GSRV-SRV2"
pool myServer2
}
"/GSRV-SRV3*" {
HTTP::uri [string range [HTTP::uri] 10 end]
set SRVResponse "/GSRV-SRV3"
pool myServer3
}
}
}
when HTTP_RESPONSE {
catch the content
set content_length 0
if { [HTTP::header exists Content-Length] } { set content_length [HTTP::header Content-Length] }
else { set content_length 2000000 }
if { $content_length > 0 } { HTTP::collect $content_length }
}
when HTTP_RESPONSE_DATA {
switch $SRVResponse {
"/GSRV-SRV1" {
do something like rewriting
}
"/GSRV-SRV2" {
do something like rewriting
}
"/GSRV-SRV3" {
do something like rewriting
}
}
}