Forum Discussion
nitass
Sep 06, 2014Employee
But if I issue an ADAPT for a response adapter in the HTTP_RESPONSE event then want to use that response to determine whether to retry, there doesn't seem to be any way to do so.
would it be possible to use HTTP::respond instead?
i have limited knowledge about icap server configuration. anyway, this is my testing. not sure if it is useful.
config
root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm virtual bar
ltm virtual bar {
destination 172.28.24.10:80
ip-protocol tcp
mask 255.255.255.255
pool foo
profiles {
http { }
myresp_adapt {
context serverside
}
tcp { }
}
rules {
qux
}
source 0.0.0.0/0
source-address-translation {
type automap
}
vs-index 7
}
root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm profile response-adapt myresp_adapt
ltm profile response-adapt myresp_adapt {
app-service none
internal-virtual adapt
}
root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm rule qux
ltm rule qux {
when HTTP_REQUEST {
log local0. ""
set host [HTTP::host]
set uri [HTTP::uri]
}
when HTTP_RESPONSE {
log local0. ""
}
when ADAPT_RESPONSE_RESULT {
log local0. "ADAPT::result = [ADAPT::result]"
if { [ADAPT::result] equals "bypass" } {
set redirect 1
} else {
set redirect 0
}
}
when HTTP_RESPONSE_RELEASE {
log local0. ""
if { $redirect } {
HTTP::respond 302 Location "http://${host}${uri}" noserver
}
}
}
root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm virtual adapt
ltm virtual adapt {
destination any:0
internal
ip-protocol tcp
mask any
pool c-icap
profiles {
myicap { }
tcp { }
}
rules {
myrule
}
source 0.0.0.0/0
translate-address disabled
translate-port disabled
vlans-enabled
vs-index 9
}
root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm rule myrule
ltm rule myrule {
when ICAP_RESPONSE {
log local0. "ICAP::status = [ICAP::status]"
if { [ICAP::status] == 200 } {
IVS_ENTRY::result noop
}
}
}
test
[root@centos1 ~] curl -I http://172.28.24.10
HTTP/1.0 302 Found
Location: http://172.28.24.10/
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
/var/log/ltm
[root@ve11a:Active:In Sync] config tail -f /var/log/ltm
Sep 6 02:08:59 ve11a info tmm1[15094]: Rule /Common/qux HTTP_REQUEST:
Sep 6 02:09:02 ve11a info tmm1[15094]: Rule /Common/qux HTTP_RESPONSE:
Sep 6 02:09:02 ve11a info tmm1[15094]: Rule /Common/myrule ICAP_RESPONSE: ICAP::status = 200
Sep 6 02:09:02 ve11a info tmm1[15094]: Rule /Common/qux ADAPT_RESPONSE_RESULT: ADAPT::result = bypass
Sep 6 02:09:02 ve11a info tmm1[15094]: Rule /Common/qux HTTP_RESPONSE_RELEASE: