Forum Discussion
Stanislas_Piro2
Jul 06, 2017Cumulonimbus
Hi,
you can try this code:
when HTTP_REQUEST {
STREAM::disable
if { [HTTP::header exists "Accept-Encoding"] } {
HTTP::header remove "Accept-Encoding"
}
set host [HTTP::host]
}
when HTTP_REQUEST_RELEASE {
if {![info exists streamfilter]} {
this part create the stream filter to convert absolute URL to relative URL if it is on the same web service.
Must be done in client side (event HTTP_REQUEST_RELEASE) to get the pool member port number.
set port [TCP::remote_port]
set streamfilter [list "@http://${host}/@/@ @http://${host}:${port}/@/@"]
}
}
when HTTP_RESPONSE {
if { [HTTP::header exists "Location"] } {
if { [set Location [HTTP::header Location]] starts_with "http://"} {HTTP::header replace Location [string map $streamfilter $Location]}
}
if {[HTTP::header value Content-Type] contains "text" || [HTTP::header value Content-Type] contains "xml" } {
apply stream filter
STREAM::expression $streamfilter
Enable the stream filter for this response only
STREAM::enable
}
}